Stock status change. Closes #462.
This commit is contained in:
parent
aba310f321
commit
360ca6f0af
|
@ -198,7 +198,7 @@ class woocommerce_product {
|
|||
update_post_meta($this->id, '_stock', $this->stock);
|
||||
|
||||
// Out of stock attribute
|
||||
if (!$this->is_in_stock()) :
|
||||
if ($this->managing_stock() && !$this->backorders_allowed() && $this->get_total_stock()<=0) :
|
||||
update_post_meta($this->id, '_stock_status', 'outofstock');
|
||||
$woocommerce->clear_product_transients( $this->id ); // Clear transient
|
||||
endif;
|
||||
|
@ -219,7 +219,10 @@ class woocommerce_product {
|
|||
update_post_meta($this->id, '_stock', $this->stock);
|
||||
|
||||
// Out of stock attribute
|
||||
if ($this->is_in_stock()) update_post_meta($this->id, '_stock_status', 'instock');
|
||||
if ($this->managing_stock() && ($this->backorders_allowed() || $this->get_total_stock()>0)) :
|
||||
update_post_meta($this->id, '_stock_status', 'instock');
|
||||
$woocommerce->clear_product_transients( $this->id ); // Clear transient
|
||||
endif;
|
||||
|
||||
return $this->stock;
|
||||
endif;
|
||||
|
|
Loading…
Reference in New Issue