woocommerce_store_api_product_quantity_limit хук-фильтрWC 1.0

Filters the quantity limit for a product being added to the cart via the Store API.

Filters the variation option name for custom option slugs.

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

add_filter( 'woocommerce_store_api_product_quantity_limit', 'wp_kama_woocommerce_store_api_product_quantity_limit_filter', 10, 2 );

/**
 * Function for `woocommerce_store_api_product_quantity_limit` filter-hook.
 * 
 * @param integer     $quantity_limit Quantity limit which defaults to 9999 unless sold individually.
 * @param \WC_Product $product        Product instance.
 *
 * @return integer
 */
function wp_kama_woocommerce_store_api_product_quantity_limit_filter( $quantity_limit, $product ){

	// filter...
	return $quantity_limit;
}
$quantity_limit(int)
Quantity limit which defaults to 9999 unless sold individually.
$product(\WC_Product)
Product instance.

Где вызывается хук

QuantityLimits::get_product_quantity_limit()
woocommerce_store_api_product_quantity_limit
woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/QuantityLimits.php 160
return apply_filters( 'woocommerce_store_api_product_quantity_limit', max( min( array_filter( $limits ) ), 1 ), $product );

Где используется хук в WooCommerce

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