-
Notifications
You must be signed in to change notification settings - Fork 66
Enable or Disable Cookie Filter
Ryan Hungate edited this page Aug 4, 2021
·
5 revisions
We've had a few requests to disable cookies for site shoppers. We've decided that the best way for our plugin to handle this is by allowing a custom function ( true or false ) for whether or not the cookie should be allowed.
Typically people just request "no" or "yes" to using any cookies, so the easiest way to turn these off would be to return false in this custom filter. We will pass in the cookie name as the only argument if you need to further customize the experience.
Keep in mind that you will lose abandoned cart automations for all guest customers if you return false on this filter, but logged in users will pass over as expected. The custom callback is only for cookies used by Mailchimp, which are very limited like:
// cookies used
// mailchimp_user_email
// mailchimp_landing_site
// mailchimp_campaign_id
// mailchimp_user_previous_email
// the cookie name will be whatever we're trying to set. return true if allowed, false if not allowed.
function custom_cookie_callback_function($cookie_name) {
return false;
}
add_filter( 'mailchimp_allowed_to_use_cookie', 'custom_cookie_callback_function', 10, 1 );