woocommerce_store_api_product_quantity_(value_type) хук-фильтрWC 1.0

Filters the quantity minimum for a cart item in Store API. This allows extensions to control the minimum qty of items already within the cart.

The suffix of the hook will vary depending on the value being filtered. For example, minimum, maximum, multiple_of, editable.

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

add_filter( 'woocommerce_store_api_product_quantity_(value_type)', 'wp_kama_woocommerce_store_api_product_quantity_value_type_filter', 10, 3 );

/**
 * Function for `woocommerce_store_api_product_quantity_(value_type)` filter-hook.
 * 
 * @param mixed       $value     The value being filtered.
 * @param \WC_Product $product   The product object.
 * @param array|null  $cart_item The cart item if the product exists in the cart, or null.
 *
 * @return mixed
 */
function wp_kama_woocommerce_store_api_product_quantity_value_type_filter( $value, $product, $cart_item ){

	// filter...
	return $value;
}
$value(разное)
The value being filtered.
$product(\WC_Product)
The product object.
$cart_item(массив|null)
The cart item if the product exists in the cart, or null.

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

QuantityLimits::filter_value()
woocommerce_store_api_product_quantity_(value_type)
woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/QuantityLimits.php 206
return apply_filters( "woocommerce_store_api_product_quantity_{$value_type}", $value, $product, $cart_item );

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

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