Skip to content

Using Caches

khungate edited this page Dec 12, 2024 · 5 revisions

Using Caches with MailChimp for WooCommerce

Welcome to the guide on Using Caches in the MailChimp for WooCommerce Integration. This guide will help you understand how to configure your caching plugins appropriately to ensure optimal performance while maintaining functionality.

Overview

Caching and the Overview Screen

The "overview" screen of the plugin makes calls to the WP REST API to show you stats on how your sync is progressing. If you're using a caching system, you might see zeros across the board on your stats. This is by design. Your cache is returning the "last result" it had saved to speed up your site in other areas.

Known Issues with Popular Caching Solutions

LiteSpeed Cache

Potential Issues

  • When "admin caching" and "REST API" features are enabled, the Action Scheduler may be prevented from running properly (limited to a few times per day)
  • May interfere with real-time sync statistics

Recommended Configuration

  1. Navigate to Cache > Excludes and add the following URI:
    ^/mailchimp-for-woocommerce/
    

LiteSpeed Cache Excludes

  1. Under Cache > Object settings:

    • Disable wp-admin caching
    • Ensure REST API caching is disabled for MailChimp routes

    LiteSpeed Cache Object Settings

Cloudflare

Configuration Tips

  1. Create a Page Rule to bypass cache for:

    • WP Admin area
    • REST API endpoints
    • MailChimp for WooCommerce specific routes
  2. Exclude critical pages from caching:

    • My Account
    • Checkout
    • Cart

General Caching Configuration

Excluding Routes

Different caching plugins use various syntax for exclusions:

  • Some use asterisks: mailchimp-for-woocommerce/*
  • Others use percentage signs: mailchimp-for-woocommerce/%
  • LiteSpeed uses regex: ^/mailchimp-for-woocommerce/

Consult your specific caching plugin's documentation for the correct exclusion syntax.

Critical Pages to Exclude

Always ensure these pages are excluded from caching:

  • My Account
  • Checkout
  • Cart
  • WP Admin area
  • REST API endpoints related to MailChimp

Optimizing Performance

Server-Side Cron Setup

To ensure reliable syncing, set up a server-side cron job:

  1. Add this to your crontab (replace with your domain):

    */1 * * * * wget https://your_wp_site/wp-cron.php
  2. Add to wp-config.php:

    define('DISABLE_WP_CRON', true);

High Performance Mode

For larger stores, enable high performance mode by adding to wp-config.php:

define('MAILCHIMP_HIGH_PERFORMANCE', true);
define('MAILCHIMP_HIGH_PERFORMANCE_PROCESSES', 20);

Note: Adjust the number of processes based on your server's resources.