Fix to ensure stock status is updated, even when meta is blank. Prevents new products being hidden when the option to hide out of stock products is enabled.

This commit is contained in:
Mike Jolley 2014-02-12 14:38:56 +00:00
parent 4c52422fc3
commit 1cafd4f566
1 changed files with 1 additions and 3 deletions

View File

@ -217,9 +217,7 @@ class WC_Product {
public function set_stock_status( $status ) {
$status = ( 'outofstock' === $status ) ? 'outofstock' : 'instock';
if ( $this->stock_status != $status ) {
update_post_meta( $this->id, '_stock_status', $status );
if ( update_post_meta( $this->id, '_stock_status', $status ) ) {
do_action( 'woocommerce_product_set_stock_status', $this->id, $status );
}
}