woocommerce_cart_item_set_quantity action-hookWC 3.6.0

Fired after qty has been changed.

Usage

add_action( 'woocommerce_cart_item_set_quantity', 'wp_kama_woocommerce_cart_item_set_quantity_action', 10, 3 );

/**
 * Function for `woocommerce_cart_item_set_quantity` action-hook.
 * 
 * @param string  $cart_item_key contains the id of the cart item. This may be empty if the cart item does not exist any more.
 * @param int     $quantity      contains the quantity of the item.
 * @param WC_Cart $that          Cart class.
 *
 * @return void
 */
function wp_kama_woocommerce_cart_item_set_quantity_action( $cart_item_key, $quantity, $that ){

	// action...
}
$cart_item_key(string)
contains the id of the cart item. This may be empty if the cart item does not exist any more.
$quantity(int)
contains the quantity of the item.
$that(WC_Cart)
Cart class.

Changelog

Since 3.6.0 Introduced.

Where the hook is called

WC_Cart::set_quantity()
woocommerce_cart_item_set_quantity
woocommerce/includes/class-wc-cart.php 1378
do_action( 'woocommerce_cart_item_set_quantity', $cart_item_key, $quantity, $this );

Where the hook is used in WooCommerce

woocommerce/includes/class-wc-cart-session.php 81
add_action( 'woocommerce_cart_item_set_quantity', array( $this, 'persistent_cart_update' ) );