Skip to content

Instantly share code, notes, and snippets.

@danquah
Created September 10, 2012 10:23
Show Gist options
  • Save danquah/3690160 to your computer and use it in GitHub Desktop.
Save danquah/3690160 to your computer and use it in GitHub Desktop.
commerce_stock-check-for-product.patch
--- /tmp/commerce_stock.module 2012-09-10 11:34:24.000000000 +0200
+++ commerce_stock.module 2012-09-10 11:34:38.000000000 +0200
@@ -419,7 +419,7 @@ function commerce_stock_checkout_validat
$found_errors = FALSE;
// Check each line item
foreach ($order_wrapper->commerce_line_items as $index => $line_item_wrapper) {
- if(in_array($line_item_wrapper->type->value(), commerce_product_line_item_types())) {
+ if ($line_item_wrapper->getBundle() == 'product' && in_array($line_item_wrapper->type->value(), commerce_product_line_item_types())) {
$product_id = $line_item_wrapper->commerce_product->product_id->value();
$product = commerce_product_load($product_id);
$qty_ordered = commerce_stock_check_cart_product_level($product_id);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment