Merge pull request #20021 from woocommerce/fix/19967
Switch stock status when manage stock gets changed and qty is sufficient.
This commit is contained in:
commit
ec02a133a3
|
@ -1314,7 +1314,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
|
||||||
$this->set_stock_status( 'onbackorder' );
|
$this->set_stock_status( 'onbackorder' );
|
||||||
|
|
||||||
// If the stock level is changing and we do now have enough, force in stock status.
|
// If the stock level is changing and we do now have enough, force in stock status.
|
||||||
} elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) && array_key_exists( 'stock_quantity', $this->get_changes() ) ) {
|
} elseif ( $this->get_stock_quantity() > get_option( 'woocommerce_notify_no_stock_amount', 0 ) && ( array_key_exists( 'stock_quantity', $this->get_changes() ) || array_key_exists( 'manage_stock', $this->get_changes() ) ) ) {
|
||||||
$this->set_stock_status( 'instock' );
|
$this->set_stock_status( 'instock' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue