Support » Plugin: YITH WooCommerce Wishlist » Cache for guests and cookies

  • Hi. Although there are certain bugs and glitches in your plugin, I’m almost satisfied with it. Thank you šŸ™‚

    I have “add to wishlist” in menu and on archive, single product pages. In menu wishlist counter is updated with JS, most probably takes info from a cookie. While pages content is rendered statically, sadly. And it is cached.

    The easiest solution for me would be to disable cache if user have at least one item in wishlist. I could check if user has yith_wcwl_products cookie. Bad thing is, your cookile is not removed even if user removed last item from his wishlist.

    Could you remove your cookie for empty lists please?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Dima Stefantsov

    (@dima-stefantsov)

    Having “add to wishlist” contents rendered with JS from cookie instead of cachable flat php->html would be a good thing too, but I’m not sure my theme (shopkeeper) would support it, it has your wishlist embedded with custom code in archives page too.

    Only 100% working solution I see right now is disabling cache if user has certain cookie. I’d just like to re-enable cache for a user that emptied his wishlist, no need to slow him down anymore.

    Plugin Author YITHEMES

    (@yithemes)

    Hello there,
    hope you are doing well! šŸ™‚

    Unfortunately, at this moment it’s not possible to remove the cookies, but we will include a filter within next update to avoid setting cookies. So with this, you can add the conditions that you need.

    We will ask you for a little bit of patience until the next update will be available and you can check if this can solve your problems.

    Many thanks for contact us.

    Have a nice day!

    Thread Starter Dima Stefantsov

    (@dima-stefantsov)

    Avoiding setting cookie is not what I need.

    There is a thread https://stackoverflow.com/questions/686155/remove-a-cookie describing how to remove a cookie in php. Are you saying it doesn’t work?

    I’ve seen your code, you are not trying to pass empty value, it’s just empty serialized array (resulting in ‘[]’ string) and date in past, which might be not enough.

    Could you please actually remove your cookie on removing all products from wishlist, not just set empty array there?

    Plugin Author YITHEMES

    (@yithemes)

    Hello,

    could you please try to add this snippet to your functions.php of your theme and check if this makes your site work as you like?

    ********************************
    if ( function_exists( ‘yith_wishlist_install’ ) ){

    if ( ! function_exists( ‘yith_wcwl_cookie_expiration_call_back’ ) ) {

    function yith_wcwl_cookie_expiration_call_back() {

    return 0;

    }

    add_filter( ‘yith_wcwl_cookie_expiration’, ‘yith_wcwl_cookie_expiration_call_back’, 10 );

    }

    }
    ********************************

    Thank you for your interest.
    Have a good a day.

    I second Dima’s concern.
    To make the wishlist work with caching I need to create an exclusion in the caching plugin. So whenever a cookie yith_wcwl_products is set the website essentially isn’t cached. And that’s (sort of) ok.
    The problem is that when a user removes all products from their wishlist the cookie still persists further preventing website caching for this user.
    So to be clear: we would like the yith_wcwl_products to be removed altogether when the user removes the final product from their wishlist.
    Does this make sense?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cache for guests and cookies’ is closed to new replies.