• Resolved milord85

    (@milord85)


    Dear support,
    we cant find how to empty the cart when user logout.

    we found this snippet but it doesn’t work

    can you confirm this snippet doesn’t work anymore?

    function your_function() {
    if( function_exists(‘WC’) ){
    WC()->cart->empty_cart();
    }
    }
    add_action(‘wp_logout’, ‘your_function’);

    • This topic was modified 4 years, 7 months ago by milord85.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Howdy @milord85

    That code snippet does not look exactly right. I searched around and found this forum thread that will help you. Please check and see if it works for you.

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We haven’t heard from you in a while, so I’m going to mark this as resolved. Feel free to start a new thread if you have any more questions!

    Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Empty cart on loggout’ is closed to new replies.