我正在尝试检索产品ID。我可以通过查找产品页面找到产品SKU，并使用<代码> commerce_product_load_by_sku() 加载它。
I am trying to retrieve the product IDs. I can find a product SKU by looking on the product page and using
commerce_product_load_by_sku() to load it.
How can I find the actual ID? I would like to use it in
According to the docs I found here
commerce_product_load_by_sku($sku) will return a
$product object and one of the properties is
$product = commerce_product_load_by_sku($sku); drupal_set_message($product->product_id);
The product object looks something like this:
[product_id] => 5 [sku] => EX151 [type] => class [language] => und [title] => Example Product [uid] => 1 [status] => 1 [created] => 1316634672 [changed] => 1316639451 [data] => [commerce_price] => Array ( [und] => Array (  => Array ( [amount] => 12500 [currency_code] => USD [data] => Array ( [components] => Array ( ) ) ) ) )
If you do not need the id to be retrieved in a function but just for a quick check, do
Commerce Backoffice: All Product variations. View this view.