Switch stock status when manage stock gets changed.

As the stock quantity might be saved in the database from previous settings, stock_status needs to be in sync if qty is > 0.
This commit is contained in:
Peter Fabian 2018-05-07 16:01:59 +02:00
parent 8d6bbabc58
commit c2493310d9
1 changed files with 1 additions and 1 deletions

View File

@ -1314,7 +1314,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
$this->set_stock_status( 'onbackorder' );
// 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' );
}
}