Support » Plugin: YITH WooCommerce Wishlist » Yith Wishlist Cookie Duration

  • I have installed and am using Yith Wishlist on my site.

    Adding products to the wishlist works perfectly.

    The problem is that the cookie only seems to last 12 hours.

    I have tested this over and over and when I add a product it shows in the wishlist. I can keep coming back and I still see it. However, when I come back about 12 hours later the product is no longer there. I have no cleared cookies or cache so it has nothing to do with that.

    How can I change the length of time the cookie lasts?

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

    (@yithemes)

    Hi there

    I checked the code, and cookies that the plugin sets should expire after 30 days
    Anyway, we have an handy filter that let third party developers to change cookie expiration 🙂

    Just try to add the following code at the end of functions.php file of your theme or child

    
    if( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwcl_change_cookie_expiration' ) ){
        function yith_wcwcl_change_cookie_expiration( $expiration ){
            return 60 * DAY_IN_SECONDS;
        }
        add_filter( 'yith_wcwl_cookie_expiration', 'yith_wcwcl_change_cookie_expiration' );
    }
    

    This should set expiration to 60 days

    • This reply was modified 1 year, 7 months ago by YITHEMES.

    Does this code you gave me set the expiration date to 60 days?

    It says:

    “return 60 * DAY_IN_SECONDS”

    do I need to put it in seconds?

    What do I place there for a 120 days expiration date?

    This doesn’t work at all. Still only stores a cookies for less than 12 hours. I go back and the items are gone from my favorites.

    Does this code you gave me set the expiration date to 60 days?

    It says:

    “return 60 * DAY_IN_SECONDS”

    do I need to put it in seconds?

    What do I place there for a 120 days expiration date?

    Plugin Author YITHEMES

    (@yithemes)

    Hello @bsl64,

    for set the expiration to 120 days, you should put:

    return 120 * DAY_IN_SECONDS

    Please try it and let me know.

    Have a good day,
    YIThemes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Yith Wishlist Cookie Duration’ is closed to new replies.