Fixed the type returned when get_stock_quantity() is empty
Since expect return an integer value, we can't return an empty string. This can generate some kinds of errors like: '' >= 1 returns false '' >= -1 returns true This can be a problem comparing stock quantity like we do in WC_Product::has_enough_stock() But using null we have: null >= 1 returns false null >= -1 returns false cc @mikejolley ref #9598
This commit is contained in:
parent
351cdee37c
commit
d931405156
|
@ -196,7 +196,7 @@ class WC_Product {
|
|||
* @return int
|
||||
*/
|
||||
public function get_stock_quantity() {
|
||||
return apply_filters( 'woocommerce_get_stock_quantity', $this->managing_stock() ? wc_stock_amount( $this->stock ) : '', $this );
|
||||
return apply_filters( 'woocommerce_get_stock_quantity', $this->managing_stock() ? wc_stock_amount( $this->stock ) : null, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue