Skip to content

Instantly share code, notes, and snippets.

@micahredding
Last active December 14, 2015 21:49
Show Gist options
  • Save micahredding/5153630 to your computer and use it in GitHub Desktop.
Save micahredding/5153630 to your computer and use it in GitHub Desktop.
get current product
global $user;
$cart = commerce_cart_order_load($user->uid);
if($cart) {
$line = commerce_line_item_load($cart->commerce_line_items['und'][0]['line_item_id']);
$product = commerce_product_load($line->commerce_product['und'][0]['product_id']);
$sku = $product->sku;
dpm($sku);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment