woocommerce_cart_emptied action-hookWC 9.7.0

Fires after the cart is emptied.

Usage

add_action( 'woocommerce_cart_emptied', 'wp_kama_woocommerce_cart_emptied_action' );

/**
 * Function for `woocommerce_cart_emptied` action-hook.
 * 
 * @param bool $clear_persistent_cart Whether the persistent cart was cleared too.
 *
 * @return void
 */
function wp_kama_woocommerce_cart_emptied_action( $clear_persistent_cart ){

	// action...
}
$clear_persistent_cart(true|false)
Whether the persistent cart was cleared too.

Changelog

Since 9.7.0 Introduced.

Where the hook is called

WC_Cart::empty_cart()
woocommerce_cart_emptied
woocommerce/includes/class-wc-cart.php 690
do_action( 'woocommerce_cart_emptied', $clear_persistent_cart );

Where the hook is used in WooCommerce

woocommerce/includes/class-wc-cart-session.php 75
add_action( 'woocommerce_cart_emptied', array( $this, 'destroy_cart_session' ) );