woocommerce_store_api_product_quantity_(value_type) filter-hookWC 6.8.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.

Usage

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(mixed)
The value being filtered.
$product(\WC_Product)
The product object.
$cart_item(array|null)
The cart item if the product exists in the cart, or null.

Changelog

Since 6.8.0 Introduced.

Where the hook is called

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

Where the hook is used in WooCommerce

Usage not found.