WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

ProductSchema::get_low_stock_remaining() protected WC 1.0

If a product has low stock, return the remaining stock amount for display.

{} It's a method of the class: ProductSchema{}

No Hooks.

Return

Int|null.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_low_stock_remaining( $product );
$product(WC_Product) (required)
Product instance.

Code of ProductSchema::get_low_stock_remaining() WC 5.8.0

protected function get_low_stock_remaining( \WC_Product $product ) {
	$remaining_stock = $this->get_remaining_stock( $product );

	if ( ! is_null( $remaining_stock ) && $remaining_stock <= wc_get_low_stock_amount( $product ) ) {
		return max( $remaining_stock, 0 );
	}

	return null;
}