After connecting your store in the plugin’s e-commerce settings, it will ask you whether you want to record all past orders in Mailchimp. By default, this happens by means of your browser sending requests to the server processing batches of 100 orders at a time.

However, this is quite a hefty process and doing it over your web server can be slow as this usually imposes all sorts of limits. If you have command line access to your server with WP-CLI installed, we got you covered with a few useful commands.

Available CLI commands

Before we proceed, ensure you have your store connected via the MC4WP > Ecommerce page, otherwise the commands are never registered.

After e-commerce is enabled, the following commands will be available.

wp mc4wp-ecommerce add-orders –limit=<limit> –offset=<offset> –delay=<delay>

This command can be used to record all untracked orders, for example when you’re initially enabling e-commerce integration.

The add-orders command accepts three optional arguments, limit, offset and delay. By default, the command is limited to 1000 orders.

Example: 

wp mc4wp-ecommerce add-orders --limit=999999

wp mc4wp-ecommerce add-order <order-id>

Add the order with the specified ID to your Mailchimp account.

Example: wp mc4wp-ecommerce add-order 150

wp mc4wp-ecommerce delete-order <order-id>

Delete the order with the specified ID from your Mailchimp account. Please note that this doesn’t delete the actual order on your site, just the order information that was previously sent to Mailchimp.

Example: wp mc4wp-ecommerce delete-order 150

wp mc4wp-ecommerce process-queue

This command processes all queued background jobs, eg for sending the latest order data to Mailchimp. This is especially useful if you want to make sure that the plugin synchronises all changes with Mailchimp with a shorter delay than the default 5-10 minutes. Setting up a cronjob to run this command every minute will result in a much faster & more reliable event schedule.

wp mc4wp-ecommerce reset-queue

Running this command will reset all queued background jobs.