woocommerce_should_clear_cart_after_payment

woocommerce_should_clear_cart_after_payment

Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.9.5.1

apply_filters('woocommerce_should_clear_cart_after_payment') is found 1 times:

  • /includes/wc-cart-functions.php line 214
    	 *
    	 * @since 9.3.0
    	 * @param bool $should_clear_cart_after_payment Whether the cart should be cleared after payment.
    	 */
    	$should_clear_cart_after_payment = apply_filters( 'woocommerce_should_clear_cart_after_payment', $should_clear_cart_after_payment );
    
    	if ( $should_clear_cart_after_payment ) {
    		WC()->cart->empty_cart();
    	}
    }
    add_action( 'template_redirect', 'wc_clear_cart_after_payment', 20 );