Include Exclude Mailchimp Script - mailchimp/mc-woocommerce GitHub Wiki

Welcome to the guide on controlling the inclusion or exclusion of the Mailchimp script in the MailChimp for WooCommerce Integration. This guide will help you understand how to use a developer filter to check whether or not the script should be loaded.

Overview

Functionality

We provide a developer filter to control the loading of the Mailchimp script. This feature was added in response to support requests for the ability to load the Mailchimp script only on certain pages of the site.

Code Example

Usage

Here's an example of how to use the filter:

function mailchimp_should_add_script_on_this_page() {
    return true;
}
add_filter('mailchimp_add_inline_footer_script', 'mailchimp_should_add_script_on_this_page');

Notes

  • return true; means the script will be loaded.
  • return false; means the script will NOT be loaded.
  • You must determine whether or not the script should load through your custom function. We do not make any assumptions. The default value is true.