woocommerce_quantity_input_max
Filter the maximum quantity value allowed for the product.
Usage
add_filter( 'woocommerce_quantity_input_max', 'wp_kama_woocommerce_quantity_input_max_filter', 10, 2 ); /** * Function for `woocommerce_quantity_input_max` filter-hook. * * @param int $max_value Maximum quantity value. * @param WC_Product $product Product object. * * @return int */ function wp_kama_woocommerce_quantity_input_max_filter( $max_value, $product ){ // filter... return $max_value; }
- $max_value(int)
- Maximum quantity value.
- $product(WC_Product)
- Product object.
Changelog
Since 2.0.0 | Introduced. |
Where the hook is called
woocommerce_quantity_input_max
woocommerce_quantity_input_max
woocommerce/src/Blocks/BlockTypes/AddToCartWithOptionsQuantitySelector.php 160
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
woocommerce/includes/wc-template-functions.php 1951
'max_value' => apply_filters( 'woocommerce_quantity_input_max', -1, $product ),
woocommerce/templates/single-product/add-to-cart/variation-add-to-cart-button.php 23
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
woocommerce/templates/single-product/add-to-cart/simple.php 41
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
woocommerce/templates/single-product/add-to-cart/grouped.php 76
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $grouped_product_child->get_max_purchase_quantity(), $grouped_product_child ),