WooCommerce 4.2 How to clear persistent cart on logout
-
Prior to version 4, I was able to clear a users cart on logout by using the following. That is not working in 4.2.
add_action(‘wp_logout’,’custom_logout’);
function custom_logout() {
//Empty the cart on logout
WC()->cart->empty_cart();
}I would like the cart to be cleared for all users when they log out.
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WooCommerce 4.2 How to clear persistent cart on logout’ is closed to new replies.