Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
deleted 1 characters in body
Source Link
apasajja
  • 399
  • 1
  • 6
  • 17

From using commerce_price_savings_formatter, I've created field field_diskon where it only contains number. field_diskon purpose is for discount rate.

So, I can assign different discount rate for different SKU.

For getting value in field_specific_blabla attached to node, I can use:

// Extract the first field item
$specific_items = field_get_items('node', $node, 'field_specific_blabla');
$specific_item = array_shift($specific_items);

// Get the field value
$start_rent$itemvalue = $specific_item['value'];

But how to get value field_diskon attached to commerce product field?

I have no idea what entity hold commerce field. I've tried replacing node with keyword related to commerce, but still not works.

From using commerce_price_savings_formatter, I've created field field_diskon where it only contains number. field_diskon purpose is for discount rate.

So, I can assign different discount rate for different SKU.

For getting value in field_specific_blabla attached to node, I can use:

// Extract the first field item
$specific_items = field_get_items('node', $node, 'field_specific_blabla');
$specific_item = array_shift($specific_items);

// Get the field value
$start_rent = $specific_item['value'];

But how to get value field_diskon attached to commerce product field?

I have no idea what entity hold commerce field. I've tried replacing node with keyword related to commerce, but still not works.

From using commerce_price_savings_formatter, I've created field field_diskon where it only contains number. field_diskon purpose is for discount rate.

So, I can assign different discount rate for different SKU.

For getting value in field_specific_blabla attached to node, I can use:

// Extract the first field item
$specific_items = field_get_items('node', $node, 'field_specific_blabla');
$specific_item = array_shift($specific_items);

// Get the field value
$itemvalue = $specific_item['value'];

But how to get value field_diskon attached to commerce product field?

I have no idea what entity hold commerce field. I've tried replacing node with keyword related to commerce, but still not works.

Source Link
apasajja
  • 399
  • 1
  • 6
  • 17

Getting field value that attached to Commerce product field

From using commerce_price_savings_formatter, I've created field field_diskon where it only contains number. field_diskon purpose is for discount rate.

So, I can assign different discount rate for different SKU.

For getting value in field_specific_blabla attached to node, I can use:

// Extract the first field item
$specific_items = field_get_items('node', $node, 'field_specific_blabla');
$specific_item = array_shift($specific_items);

// Get the field value
$start_rent = $specific_item['value'];

But how to get value field_diskon attached to commerce product field?

I have no idea what entity hold commerce field. I've tried replacing node with keyword related to commerce, but still not works.