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
$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.
You should be able to use entity_metadata_wrapper quite nicely for this. Note that it is part of the Entity API, but that is a dependency of Drupal Commerce so you'll be fine in this case.

Something like the following code should do it:

$wrapper = entity_metadata_wrapper('commerce_product', YOUR-REQUIRED-PRODUCT-ID);

$discount = $wrapper-&gt;field_diskon-&gt;value();


You can find out more about how to use entity_metadata_wrapper() here.