After connecting your store in the plugin Ecommerce 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 MailChimp for WP > Ecommerce page, otherwise the commands are never registered.
After Ecommerce is enabled, the following commands will be available.
wp mc4wp-ecommerce add-orders –limit=<limit> –offset=<offset>
This command can be used to record all untracked orders, for example when you’re initially enabling Ecommerce integration.
The `add-orders` command accepts two optional arguments, `limit` and `offset`. 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.