Created
December 8, 2017 06:14
-
-
Save kaysersoze/78df1bba610b6915f45559d79135aa10 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- woocommerce-product-stock-alert/classes/class-woo-product-stock-alert-frontend.php 2017-11-12 15:28:59.000000000 -0700 | |
+++ woocommerce-product-stock-alert-mod/classes/class-woo-product-stock-alert-frontend.php 2017-11-12 15:34:41.000000000 -0700 | |
@@ -227,10 +227,25 @@ | |
$dc_settings = $this->dc_plugin_settings; | |
if($product) { | |
+ if($product->is_type('composite')) { | |
+ $manage_stock = false; | |
+ $composited_products = $product->get_composite_data(); | |
+ foreach($composited_products as $component) { | |
+ $wc_product = new WC_Product($component['default_id']); | |
+ $composited_product_quantity = $wc_product->get_stock_quantity(); | |
+ | |
+ if(!$wc_product->is_in_stock()) { | |
+ $manage_stock = $wc_product->managing_stock(); | |
+ $stock_quantity = $wc_product->get_stock_quantity(); | |
+ break; | |
+ } | |
+ } | |
+ } else { | |
$managing_stock = $product->managing_stock(); | |
$stock_quantity = $product->get_stock_quantity(); | |
$manage_stock = $product->get_manage_stock(); | |
$stock_status = $product->get_stock_status(); | |
+ } | |
if( isset($stock_quantity) && $manage_stock ) { | |
if($managing_stock && $stock_quantity <= (int)get_option( 'woocommerce_notify_no_stock_amount' )){ | |
@@ -250,6 +265,8 @@ | |
$display_stock_alert_form = true; | |
} | |
} | |
+ } else if($product->is_type('composite')) { | |
+ | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment