WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

ProductSchema::get_product_quantity_limit() protected WC 1.0

Get the quantity limit for an item in the cart.

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

Return

Int.

Usage

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

Code of ProductSchema::get_product_quantity_limit() WC 5.7.0

protected function get_product_quantity_limit( \WC_Product $product ) {
	$limits = [ 99 ];

	if ( $product->is_sold_individually() ) {
		$limits[] = 1;
	} elseif ( ! $product->backorders_allowed() ) {
		$limits[] = $this->get_remaining_stock( $product );
	}

	return apply_filters( 'woocommerce_store_api_product_quantity_limit', max( min( array_filter( $limits ) ), 1 ), $product );
}