Title: WP-CLI usage
Last modified: March 10, 2024

---

# WP-CLI usage

 *  Resolved [Ben Andersen](https://wordpress.org/support/users/ben72/)
 * (@ben72)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/)
 * Hi!
   In the stats for my latest Mailchimp campaign I can’t see order stats and
   I’m positive I got orders through the campaign. I have 14,838 orders and the 
   your UI says 14,542 are synced.
 * I tried to run sync through WP-CLI but it does not seem to work. Can you please
   give me instructions on how to do it correctly? The information here seems to
   be outdated, [https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode](https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode)
 * On the plugin screen I now see “We dectected that this site has the following
   constants defined, likely at wp-config.php file: DISABLE_WP_HTTP_WORKER
   These
   constants are deprecated since Mailchimp for Woocommerce version 2.3. Please 
   refer to the [plugin official wiki](https://github.com/mailchimp/mc-woocommerce/wiki/)
   for further details.”
 * ![](https://www.dropbox.com/scl/fi/g0yn7ws7qg69a8843mdsu/mailchimp-issue-240309.
   jpg?rlkey=3ba14znjxbfl4wq21ar4tfb5y&dl=0)
 * Warning message, view source to see it..
 * I got it to work by clicking the [RESYNC NOW] button in the UI and then run “
   wp –url=https://my-actual-site.com action-scheduler run”. Is that the right way?
   I thought you would have a WP-CLI command for syncing like the mc4wp plugin does.
   Could you make that more clear in the instructions and change the information
   about the deprecated constant?
 * Btw, I got quite a few of these when processing orders. Is that when a product
   in an order has been deleted?
 *     ```wp-block-code
       Warning: Undefined array key 0 in /home/ekoinsik/public_html/my-site.com/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-products.php on line 348
       Warning: Attempt to read property "product_id" on null in /home/ekoinsik/public_html/my-site.com/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-products.php on line 348
       ```
   
 * It’s still syncing and it has taken all day. It takes about 2 sec per order it
   seems. Is that normal with WP-CLI? I have 5 GB memory.
 * Thanks!
    -  This topic was modified 2 years ago by [Ben Andersen](https://wordpress.org/support/users/ben72/).
      Reason: make things more clear
    -  This topic was modified 2 years ago by [Ben Andersen](https://wordpress.org/support/users/ben72/).
      Reason: Image fixes
    -  This topic was modified 2 years ago by [Ben Andersen](https://wordpress.org/support/users/ben72/).
      Reason: Image fixes

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Support [khungate](https://wordpress.org/support/users/khungate/)
 * (@khungate)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17498195)
 * Hi @BenAndersen,
 * Regarding your WP-CLI usage for syncing Mailchimp campaign order stats, I noticed
   you’re experiencing discrepancies in order numbers and deprecated constant warnings.
   It seems you’re also concerned about the efficiency of the sync process.
 * To address the sync issue and improve efficiency, you might consider the following
   approach provided by our development team:
    1. **Disabling the Default Queue Runner**: This involves adding a snippet to your
       theme’s `functions.php` file or a custom plugin. The snippet checks for the `
       ActionScheduler` class and removes the default action scheduler run queue. This
       is done to prevent potential conflicts or overload during the sync process.
 *     ```wp-block-code
          function asdds_disable_default_runner() {
              if ( class_exists( 'ActionScheduler' ) ) {
                  remove_action( 'action_scheduler_run_queue', array( ActionScheduler::runner(), 'run' ) );
              }
          }
          add_action( 'init', 'asdds_disable_default_runner', 10 );
       ```
   
    2. **Running Resync with a Button**: It sounds like you have a custom solution 
       to trigger the resync process. Ensuring this is user-friendly and accessible
       can help manage syncs more efficiently.
    3. **Manual Sync via Server Console**: Running `wp action-scheduler run` in your
       server console can manually trigger the sync process. This can be a good workaround
       if automated processes are failing or if you need an immediate sync.
 * Remember, after applying these changes, it’s crucial to test the sync process
   to ensure that it runs more smoothly and without adding undue load on your server.
 * I hope this helps address some of your concerns. It’s always a good idea to backup
   your site before making changes, and consider reaching out to a professional 
   if you’re unsure. Please let us know if you need anything else.
 *  Plugin Support [khungate](https://wordpress.org/support/users/khungate/)
 * (@khungate)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17519055)
 * Hi there, we just wanted to check back with you to see if this was still an issue.
   Please let us know when you get a moment, we’ll be happy to help troubleshoot
   further if necessary.
 *  Thread Starter [Ben Andersen](https://wordpress.org/support/users/ben72/)
 * (@ben72)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17519827)
 * @khugate Thank you for your reply.
 * I now have 14893 completed orders and the Mailchimp for WooCommerce UI says it
   has synced 14622 orders. Does this seem normal?
   I have been running the ActionScheduler
   through Cron since a day or two after I posted this. Running it manually, it 
   says it’s got nothing more to do.
 * I should remove DISABLE_WP_HTTP_WORKER from wp-config.php as it’s deprecated?
   It’s not used and not needed any longer?
 * Thanks!
 *  Plugin Support [khungate](https://wordpress.org/support/users/khungate/)
 * (@khungate)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17533593)
 * Hi Ben,
 * The difference in order numbers could be because of a variety of factors/settings,
   can you verify a few things?
    1. Please enable debug mode and review the logs for the Mailchimp for WooCommerce
       plugin for any messages that could indicate a failure.
    2. Check which options are activated on the Audience page in Mailchimp, as these
       settings impact the sync.
    3. Verify if the “Only sync subscribers” option is selected, which affects transactional
       customer data syncing.
    4. Investigate any additional filters from your theme or custom plugins that could
       influence the sync process.
    5. Examine your Order Data Storage settings, as they play a role in the data sync.
 * And yes, it’s recommended to remove any deprecated constants, such as `DISABLE_WP_HTTP_WORKER`,
   from your `wp-config.php` file to avoid potential conflicts. Before making these
   changes, ensure to back up your website and test its functionality afterward 
   to ensure everything operates smoothly. This approach helps in maintaining your
   site’s integrity while we work towards resolving the issue.
 *  Plugin Support [khungate](https://wordpress.org/support/users/khungate/)
 * (@khungate)
 * [2 years ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17545437)
 * Hi there, we just wanted to check back with you to see if this was still a problem
   for you. Please let us know when you get a moment, we’ll be happy to help troubleshoot
   further if necessary.
 *  Plugin Support [khungate](https://wordpress.org/support/users/khungate/)
 * (@khungate)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17560756)
 * Hi there, we’re going to close out this ticket for now since it’s been a few 
   weeks since we’ve been in touch.
 * Please let us know if you still need any help and we’ll be glad to reopen and
   troubleshoot further. Please note, that the best way to reach us is over at the
   GitHub plugin page: [https://github.com/mailchimp/mc-woocommerce/](https://github.com/mailchimp/mc-woocommerce/).
   From there, you can receive direct responses from the development team, log new
   issues, download the latest version, and track existing support tickets.
 *  Thread Starter [Ben Andersen](https://wordpress.org/support/users/ben72/)
 * (@ben72)
 * [1 year, 12 months ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17561510)
 * [@khungate](https://wordpress.org/support/users/khungate/) Thanks for your replies!
 * Your plugin now says 14652 and in Woo I have 14992 completed orders and 16659
   orders in total. 
   I don’t see any errors in the log. Is there a way to send the
   logs to you for inspection?I have the option to “Only sync subscribers” enabled.
   Could that be why the numbers differ?
 * I see that you haven’t removed DISABLE_WP_HTTP_WORKER from [https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode](https://github.com/mailchimp/mc-woocommerce/wiki/Advanced-Queue-Setup-In-CLI-mode)??
   It’s deprecated so why not remove it from your wiki page?
 * Thanks!
 *  Plugin Author [ryanhungate](https://wordpress.org/support/users/ryanhungate/)
 * (@ryanhungate)
 * [1 year, 11 months ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17679750)
 * [@ben72](https://wordpress.org/support/users/ben72/) – the reason for missing
   orders seems to be due to the deleted products issue you first reported, not 
   related to the action scheduler. This is an ongoing issue that a lot of folks
   are aware of but it’s not exactly an easy fix to implement given database constraints/
   foreign ids etc.
 * That being said, I think you have a scenario that does still classify as a bug
   that we can look into. The fact we don’t have a record to use coming from your`
   wc_order_product_lookup` table means we probably need to have an additional fallback
   function to handle this.
 * For right now, there’s nothing we can do to fix those missing orders but I’ll
   add this onto the next build for development and report back asap on progress.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘WP-CLI usage’ is closed to new replies.

 * ![](https://ps.w.org/mailchimp-for-woocommerce/assets/icon-256x256.png?rev=1509501)
 * [Mailchimp for WooCommerce](https://wordpress.org/plugins/mailchimp-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mailchimp-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mailchimp-for-woocommerce/reviews/)

 * 8 replies
 * 3 participants
 * Last reply from: [ryanhungate](https://wordpress.org/support/users/ryanhungate/)
 * Last activity: [1 year, 11 months ago](https://wordpress.org/support/topic/wp-cli-usage-3/#post-17679750)
 * Status: resolved