WC_Product::is_in_stock
Returns whether or not the product can be purchased. This returns true for 'instock' and 'onbackorder' stock statuses.
Method of the class: WC_Product{}
Hooks from the method
Returns
true|false
.
Usage
$WC_Product = new WC_Product(); $WC_Product->is_in_stock();
WC_Product::is_in_stock() WC Product::is in stock code WC 9.9.4
public function is_in_stock() { /** * Filters whether a product is in stock. * * @since 2.7.0 * @param bool $in_stock Whether the product is in stock. * @param WC_Product $product Product object. */ return apply_filters( 'woocommerce_product_is_in_stock', ProductStockStatus::OUT_OF_STOCK !== $this->get_stock_status(), $this ); }