-
Notifications
You must be signed in to change notification settings - Fork 67
How to Remove WordPress Actions Filters Added by the Plugin
Welcome to the guide on Removing WordPress Actions Filters Added by the Plugin in the MailChimp for WooCommerce Integration. This guide will help you understand how to customize various plugin functions by using the typical “remove_action” + “add_action” to replace our events with custom functions of your own.
Advanced users needed a way to have full control over rendering the newsletter checkbox, enabling/disabling Abandoned Cart tracking, etc. This feature provides more control and options to override certain areas of the plugin without impacting future updates.
We provided a way for users to remove our action by exposing the following classes as globals:
MailChimp_WooCommerce_Admin::instance();
MailChimp_Newsletter::instance();
MailChimp_Service::instance();
Using the 'singleton pattern', one can reference the correct object instance while removing actions without having to change the plugin core files.
Please reference the official WordPress documentation for removing filters here.
Here's an example of how to remove an action:
$service = MailChimp_Newsletter::instance();
remove_action('woocommerce_register_form', array($service, 'applyNewsletterField'), 10);