• Resolved noname

    (@casahova)


    Good Day,

    I would like to enquire if you have a code to clear wishlist items on logout just like this woocommerce code for empty cart on logout?

    function log_function_cart() {
    global $woocommerce;
    $woocommerce->cart->empty_cart();
    }
    add_action(‘clear_auth_cookie’, ‘log_function_cart’);

    Thanks,
    hear from you soon.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter noname

    (@casahova)

    Hi,

    Still awaiting for a response.

    Thanks

    Plugin Author templateinvaders

    (@templateinvaders)

    Hi @casahova

    You can use the next snippet to clear products from a current user wishlist on the logout event:
    https://gist.github.com/753f8d4021b41e8590512267e92c01e6

    Thread Starter noname

    (@casahova)

    Hi,

    Thank you for the snippet, however the result is not the one I am looking for. After logout, the wishlist is empty indeed, but the counter number on the wishlist icon does not become zero, but rather still reflect the previous amount. After logging back in, I would like the wishlist to restore back the account users wishlist from previous session, rather than completely clearing the whole session. Basically the result should be the same as the attached woocommerce code.

    Hear from you soon,
    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘clear wishlist on user logout’ is closed to new replies.