• maze81

    (@maze81)


    The YITH cookie must only be executed if the visitor agrees in the cookie banner.
    For this I need a script which I can insert in the Cookie Consent Tool.
    Only when the visitor agrees to all cookies should the YITH cookie be loaded.
    Unfortunately, I cannot find a cookie consent tool that automatically blocks the cookie.
    I have to enter a script for this.

    Many thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,
    we hope you’re doing well!

    Please try adding the following snippet:

    add_filter( 'yith_wcaf_set_ref_cookie', '__return_false' );

    Let us know any news.

    Best regards.

    Thread Starter maze81

    (@maze81)

    I have entered the code in different cookie consent plugins. Unfortunately without success.

    I have also inserted the filter with the plugin Code Snippets in the function.php.
    Unfortunately it does not work there either.
    The filter must be in the function.php?

    Can you recommend a cookie consent plugin?

    Many thanks in advance

    Plugin Support Juan Coronel

    (@juaancmendez)

    Hello there,

    We recommend this plugin:

    Cookie Notice & Compliance for GDPR / CCPA

    Then, try adding the following code in the functions.php file of your active child theme:

    if ( ! function_exists( 'yith_wcaf_set_session_cookie_consent' ) ) {
    	function yith_wcaf_set_session_cookie_consent( $set ) {
    		if ( function_exists( 'cn_cookies_accepted' ) && ! cn_cookies_accepted() ) {
    			return false;
    		}
    
    		return $set;
    	}
    	add_filter( 'yith_wcaf_set_ref_cookie', 'yith_wcaf_set_session_cookie_consent', 10, 1 );
    }

    This code check if the user accepted the cookies of the site (with the plugin we suggested before), so the affiliate cookie will be set as well.

    And the most important thing, you must need to activate the option we highlight in this screenshot, or the ?ref parameter won’t create the cookie.

    And that’s all!?

    In this way, the affiliate cookie will be generated only if the user accepts the cookies of your site.

    We hope it helps you.

    Have a great day!

    Thread Starter maze81

    (@maze81)

    Hello,
    have done everything following your instructions unfortunately the cookie is still loaded.

    I also tested it on a new WordPress installation with the following setup:

    • WordPress
    • WooCommerce
    • Cookie Notice & Compliance for GDPR / CCPA from Hu-manity.co
    • Code snippets

    I inserted the code with the plugin Code Snippets in the Function.php.
    The code was also inserted directly into the Function.php without plugin.
    Both variants did not work.

    In the Cookie Plugin I have activated the option “Enable to reload the page after the notice is accepted”.

    Hope you can help me further
    Many thanks in advance

    Thread Starter maze81

    (@maze81)

    Hi,

    could you please test your code yourself with Cookie Notice & Compliance for GDPR / CCPA?

    It does not work for me.

    I have tested it in a new WordPress installation, only with the following plugins:

    WooCommerce, Cookie Notice & Compliance for GDPR / CCPA and Code Snippets.

    I would appreciate a solution.

    Otherwise I cannot use YITH Affiliate as it is not GDPR compliant.

    Many thanks in advance

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Block YITH cookie with a script’ is closed to new replies.