Hi there,
I’m have trouble with the WooCommerce checkout. The Shopping cart isn’t clearing after someone purchases. When they come back to the site the product is still in their shopping cart?
Hi there,
I’m have trouble with the WooCommerce checkout. The Shopping cart isn’t clearing after someone purchases. When they come back to the site the product is still in their shopping cart?
Hi,
To achieve that you can try adding this in your child theme’s functions.php
file.
add_action( 'woocommerce_thankyou', 'order_received_empty_cart_action', 10, 1 );
function order_received_empty_cart_action( $order_id ){
WC()->cart->empty_cart();
}
For more information kindly refer to the links below
https://docs.woocommerce.com/wc-apidocs/class-WC_Cart.html
Hope this helps
You’re welcome Steve
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.