WC_Product::has_enough_stock()publicWC 1.0

Returns whether or not the product has enough stock for the order.

Метод класса: WC_Product{}

Хуков нет.

Возвращает

true|false.

Использование

$WC_Product = new WC_Product();
$WC_Product->has_enough_stock( $quantity );
$quantity(разное) (обязательный)
Quantity of a product added to an order.

Код WC_Product::has_enough_stock() WC 9.2.3

public function has_enough_stock( $quantity ) {
	return ! $this->managing_stock() || $this->backorders_allowed() || $this->get_stock_quantity() >= $quantity;
}