woocommerce_should_clear_cart_after_payment
woocommerce_should_clear_cart_after_payment
Appears in: woocommerce.9.3.1, woocommerce.9.3.3, woocommerce.9.4.2, woocommerce.9.4.3, woocommerce.9.5.1
Hook Type: filter
Displaying hooks found in version: woocommerce.9.5.1apply_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 );