• Hi,

    I have problems with Caching and Cookies.

    I tried the Caching Plugin Wp Fastest Cache and Cache Enabler. I tried to exclude the Cookie yith_wcwl_products in both Caching Plugins.

    It didn’t work and I don’t know how to solve this problem. The Heart Symbol doesn’t change on some pages, as well as the Ajax Counter doesn’t work. It doesn’t seem to be updated.

    Problem 1: On first page view the full Heart Symbols are cached too.
    Problem 2: The Ajax Counter only updates by clicking the Heart. On revisiting the site it takes the first cached Version (what is wrong…)

    Is there a way to deactivate a Cache if a user uses the wishlist?
    Do you have a guide to follow?

    Thanks in advance,

    Marko

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author YITHEMES

    (@yithemes)

    Hi

    are you running version 3.0.x of the plugin?
    In this case, cookie name changed, and now you should use yith_wcwl_session_* for exception (the actual name will contain cookiehash as the end of the name)

    Apart from disabling cache when cookies are set, I suggest you to use ajax loading of wishlist elements: you can find dedicated option under WP Dashboard -> YITH -> Wishlist -> General

    Thread Starter wpxpert00

    (@wpxpert00)

    Thank you for the fast reply,

    Ohhh I will stick with ajax loading then,
    otherwise it doesn’t work, due to the fact that the wishlist is on every page so it excludes the Cache on every page.

    How to achieve that the counter is loaded with Ajax in the beginning too ? This code I copied from another post, does the Ajax loading only on update…

    The code:

    PHP

    if( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_ajax_update_count' ) ){
    function yith_wcwl_ajax_update_count(){
    wp_send_json( array(
    'count' => yith_wcwl_count_all_products()
    ) );}
    
    add_action( 'wp_ajax_yith_wcwl_update_wishlist_count', 'yith_wcwl_ajax_update_count' );
    add_action( 'wp_ajax_nopriv_yith_wcwl_update_wishlist_count', 'yith_wcwl_ajax_update_count' );}
    

    JS

    
    $(document).on( 'added_to_wishlist removed_from_wishlist', function(){
    var counter = $('.wishlist-counter');
    
    $.ajax({
    url: yith_wcwl_l10n.ajax_url,
    data: {
    action: 'yith_wcwl_update_wishlist_count'
    },
    dataType: 'json',
    success: function( data ){
    counter.html( data.count );
    },
    beforeSend: function(){
    },
    complete: function(){
    counter.unblock();
    }
    })
    })
    

    Thanks in advance,

    Marko

    Plugin Author YITHEMES

    (@yithemes)

    Hi Marko

    You can change the js code to trigger ajax loading on document ready as follows

    $(document).on( 'added_to_wishlist removed_from_wishlist', function(){
    var counter = $('.wishlist-counter');
    
    $.ajax({
    url: yith_wcwl_l10n.ajax_url,
    data: {
    action: 'yith_wcwl_update_wishlist_count'
    },
    dataType: 'json',
    success: function( data ){
    counter.html( data.count );
    },
    beforeSend: function(){
    },
    complete: function(){
    counter.unblock();
    }
    })
    }).trigger( 'added_to_wishlist' );
    Thread Starter wpxpert00

    (@wpxpert00)

    Hi,

    Thank you very much for you answer.

    Appriciate the support! I will buy your plugin for my customers in the future!

    Last question how to get the wishlist hearts, if I have another ajax call.

    Products Load More –> Receive hearts again via Ajax?

    Best,

    Marko

    Plugin Author YITHEMES

    (@yithemes)

    Hi again Marko

    I’m sorry, but I’m not sure if I correctly understand your question
    Do you want to reload Add to Wishlist buttons via ajax after a new set of products is loaded in the page?

    Thread Starter wpxpert00

    (@wpxpert00)

    Yes exactly!

    Plugin Author YITHEMES

    (@yithemes)

    Currently there is no proper way of doing this using Fragment loading routine of the plugin
    Anyway, I will include a dedicated trigger in next version of the plugin, that will allow you to execute Fragment refresh whenever you need

    Trigger will be the following: yith_wcwl_reload_fragments
    You should use it as follows

    jQuery(document).trigger('yith_wcwl_reload_fragments')

    If you want to perform tests, I’m going to attach to this answer two patched files; just download them, and use them to replace default files of the plugin, as follows:

    File 1 -> wp-content/plugins/yith-woocommerce-wishlist-premium/assets/js/unminified/
    File 2 -> wp-content/plugins/yith-woocommerce-wishlist-premium/assets/js/

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

The topic ‘Cookies & Cache’ is closed to new replies.