woocommerce_should_clear_cart_after_payment
woocommerce_should_clear_cart_after_payment
Appears in: woocommerce.10.0.4, woocommerce.10.1.2, woocommerce.10.2.2, woocommerce.9.3.1, woocommerce.9.3.3, woocommerce.9.4.2, woocommerce.9.4.3, woocommerce.9.5.1, woocommerce.9.5.2, woocommerce.9.7.0, woocommerce.9.7.1, woocommerce.9.8.1, woocommerce.9.8.5, woocommerce.9.9.5
Hook Type: filter
Displaying hooks found in version: woocommerce.9.9.5apply_filters('woocommerce_should_clear_cart_after_payment') is found 1 times:
- /includes/wc-cart-functions.php line 194
* * @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 );