woocommerce_quantity_input_max filter-hookWC 10.1.0

Filters the maximum quantity which can be purchased at once.

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|float   $quantity The maximum quantity.
 * @param \WC_Product $that     The product object.
 *
 * @return int|float
 */
function wp_kama_woocommerce_quantity_input_max_filter( $quantity, $that ){

	// filter...
	return $quantity;
}
$quantity(int|float)
The maximum quantity.
$that(\WC_Product)
The product object.

Changelog

Since 10.1.0 Introduced.

Where the hook is called

WC_Product::get_max_purchase_quantity()
woocommerce_quantity_input_max
wc_get_quantity_input_args()
woocommerce_quantity_input_max
woocommerce/includes/abstracts/abstract-wc-product.php 2058
return wc_stock_amount( apply_filters( 'woocommerce_quantity_input_max', $this->is_sold_individually() ? 1 : ( $this->backorders_allowed() || ! $this->managing_stock() ? -1 : $this->get_stock_quantity() ), $this ) );
woocommerce/includes/wc-template-functions.php 4470
$defaults['max_value']    = apply_filters( 'woocommerce_quantity_input_max', -1, $product );

Where the hook is used in WooCommerce

Usage not found.