-
Notifications
You must be signed in to change notification settings - Fork 67
How to Remove WordPress Actions Filters Added by the Plugin
Advanced users needed a way to customize various plugin functions by using the typical “remove_action” + “add_action” to replace our events with custom functions of their own. Some use cases would be to have full control over rendering the newsletter checkbox - or enabling/disabling Abandoned Cart tracking, etc. Anyone needing to override certain areas of the plugin will have more control and options than before.
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, impacting future updates.
How to implement?
Please reference the official WordPress documentation for removing filters here.
Example:
$service = MailChimp_Newsletter::instance();
remove_action('woocommerce_register_form', array($service, 'applyNewsletterField'), 10);