Created
July 7, 2024 14:59
-
-
Save shameemreza/a62b9ddb9e1d456a9c6633433741c55f to your computer and use it in GitHub Desktop.
Empty the cart on logout in WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wc_empty_cart_logout() { | |
if( function_exists('WC') ){ | |
WC()->cart->empty_cart(); | |
} | |
} | |
add_action('wp_logout', 'wc_empty_cart_logout'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment