Core Mailchimp integration for WooCommerce. Connects a store to a single Mailchimp audience list with opt-in checkbox support for both classic and block-based checkout.
- Repo:
anderly/woocommerce-mailchimpon GitHub - WordPress.org: https://wordpress.org/plugins/woocommerce-mailchimp/
- Minimum Requirements: PHP 7.4+, WordPress 6.2+, WooCommerce 8.3+
- Entry:
woocommerce-mailchimp.php→SS_WC_MailChimp_Plugin(singleton, accessed viaSSWCMC()) - Loads at priority 11 on
plugins_loaded - All classes in
includes/
| Class | Purpose |
|---|---|
SS_WC_MailChimp_Plugin |
Singleton. Settings, constants, hooks. get_subscribe_options_for_order() builds base merge_tags (FNAME/LNAME). |
SS_WC_MailChimp_Handler |
Checkout lifecycle. Renders opt-in checkbox, saves opt-in meta, queues subscriptions via Action Scheduler. Registers Store API endpoint data for block checkout. |
SS_WC_MailChimp |
Mailchimp API wrapper. subscribe(), unsubscribe(), get_lists(), get_tags(), get_interest_categories_with_interests(), get_merge_fields(). Uses transient caching. |
SS_WC_MailChimp_Blocks_Integration |
IntegrationInterface implementation. Registers checkout.js for block-based checkout. |
SS_WC_Settings_MailChimp |
WooCommerce settings tab. Fires positional filters (ss_wc_mailchimp_settings_general_after_*) for pro plugin to inject settings. |
assets/js/blocks/checkout.js— IIFE, no build step. UsesgetSetting('woocommerce-mailchimp_data')for settings,ExperimentalOrderMetaslot, nativewc-block-components-checkboxmarkup.checkout.asset.php— declares dependencies (wp-element,wp-i18n,wp-plugins,wc-blocks-checkout,wc-settings). Version usesSS_WC_MAILCHIMP_VERSIONconstant.- Store API:
woocommerce_store_api_register_endpoint_dataregisterswoocommerce-mailchimpnamespace withss_wc_mailchimp_opt_inboolean field. - Save:
woocommerce_store_api_checkout_update_order_from_requestreads from$request->get_param('extensions'). - Important: Uses
interface_exists()notclass_exists()to check forIntegrationInterface(it's a PHP interface, not a class).
order_status_changed()→ queuesqueue_ss_wc_mailchimp_maybe_subscribevia Action Schedulermaybe_subscribe()→ reads opt-in meta, builds subscribe options, fires filters:ss_wc_mailchimp_subscribe_interest_groupsss_wc_mailchimp_subscribe_tagsss_wc_mailchimp_subscribe_merge_tags← pro plugin hooks here for merge field mappingss_wc_mailchimp_subscribe_options
- Calls
SS_WC_MailChimp::subscribe()→ Mailchimp API (PUT member + POST tags) - Fires
ss_wc_mailchimp_after_subscribe← pro plugin hooks here for per-product lists
Individual wp_options rows with ss_wc_mailchimp_ prefix. Config defaults in config/default-settings.php.
Automated via release-please. Conventional commits (feat:, fix:, BREAKING CHANGE).
- Workflow:
.github/workflows/release-please.yml - Deploys to GitHub Releases + WordPress.org SVN
- Version markers: PHP header uses
x-release-please-start-version/x-release-please-endblock annotation.readme.txtStable tag/Version updated viasedin the workflow (no inline markers — WordPress.org reads them literally).
WP_TESTS_PHPUNIT_POLYFILLS_PATH=vendor/yoast/phpunit-polyfills \
WP_TESTS_DIR=/tmp/wordpress-tests-lib \
vendor/bin/phpunitTests in tests/. Bootstrap loads WooCommerce + this plugin. Uses WP_REST_Request objects for block checkout tests (not $_POST).
Uses WooCommerce's built-in Action Scheduler (no bundled copy). All Mailchimp API calls are async via as_schedule_single_action().