woocommerce_cart_item_set_quantity
Fired after qty has been changed.
Использование
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(строка)
- 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.
Список изменений
С версии 3.6.0 | Введена. |
Где вызывается хук
woocommerce_cart_item_set_quantity
woocommerce/includes/class-wc-cart.php 1379
do_action( 'woocommerce_cart_item_set_quantity', $cart_item_key, $quantity, $this );
Где используется хук в WooCommerce
woocommerce/includes/class-wc-cart-session.php 81
add_action( 'woocommerce_cart_item_set_quantity', array( $this, 'persistent_cart_update' ) );