You are here

function commerce_product_load in Commerce Core 7

Loads a product by ID.

10 calls to commerce_product_load()
CommerceBaseTestCase::assertProductCreated in tests/commerce_base.test
Asserts that a product has been created.
CommerceBaseTestCase::createDummyOrder in tests/commerce_base.test
Create a dummy order in a given status.
CommerceProductCRUDTestCase::testCommerceProductCrud in modules/product/tests/commerce_product.test
Test the product CRUD functions.
commerce_cart_add_to_cart_form_attributes_refresh in modules/cart/commerce_cart.module
Ajax callback: returns AJAX commands when an attribute widget is changed.
commerce_cart_add_to_cart_form_submit in modules/cart/commerce_cart.module
Form submit handler: add the selected product to the cart.

... See full list

1 string reference to 'commerce_product_load'
commerce_product_entity_info in modules/product/commerce_product.module
Implements hook_entity_info().

File

modules/product/commerce_product.module, line 502
Defines the core Commerce product entity, including the entity itself, the bundle definitions (product types), and various API functions to manage products and interact with them through forms and autocompletes.

Code

function commerce_product_load($product_id) {
  if (empty($product_id)) {
    return FALSE;
  }
  $products = commerce_product_load_multiple(array(
    $product_id,
  ), array());
  return $products ? reset($products) : FALSE;
}