clear cart after log out and restore after login
-
I added the below code in “Code Snippet” to clear all cart items. Now how can I restore all cart items after logging in again for individual users?
function logout_function() {
if( function_exists(‘WC’) ){
WC()->cart->empty_cart();
}
}
add_action(‘wp_logout’, ‘logout_function’);
add_action(‘clear_auth_cookie’, ‘logout_function’);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘clear cart after log out and restore after login’ is closed to new replies.