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
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
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.