Base is_in_stock purely on stock status and not stock levels

This commit is contained in:
Mike Jolley 2016-07-01 11:59:52 +01:00
parent a942cfade8
commit 6422669c95
1 changed files with 1 additions and 14 deletions

View File

@ -608,20 +608,7 @@ class WC_Product {
* @return bool
*/
public function is_in_stock() {
$status = $this->stock_status === 'instock';
/**
* Sanity check to ensure stock qty is not lower than 0 but still listed
* instock.
*
* Check is not required for products on backorder since they can be
* instock regardless of actual stock quantity.
*/
if ( $this->managing_stock() && ! $this->backorders_allowed() && $this->get_total_stock() <= get_option( 'woocommerce_notify_no_stock_amount' ) ) {
$status = false;
}
return apply_filters( 'woocommerce_product_is_in_stock', $status );
return apply_filters( 'woocommerce_product_is_in_stock', $this->stock_status === 'instock' );
}
/**