mailchimp / mc-woocommerce

MailChimp for Woocommerce Integration. Syncs all data (subscriber, customers, orders, products) and enables marketing automation with email campaigns, automations, ads, postcards and more.
https://wordpress.org/plugins/mailchimp-for-woocommerce/
GNU General Public License v2.0
82 stars 66 forks source link

Syncing issue on v2.3.1 #551

Closed JurianBoots closed 4 years ago

JurianBoots commented 4 years ago

Hello,

I'm having issues getting our Woocommerce orders to sync to Mailchimp using the latest 2.3.1 update. The site only has about 400 orders, so I expected it would sync pretty quickly. It seems to pick up on the discount codes and products but the orders are still stuck on 0 after several days of syncing:

afbeelding

In Mailchimp under 'Connect > Connected Sites' I can see that the store is connected, but the status is stuck at 'Syncing'.

The debug logs repeat the following error (or similar) many times:

2020-01-22T13:32:59+00:00 NOTICE product_submit.error :: addStoreProduct :: #695 :: Error Code 400 :: <p>: Required fields were not provided: title</p><p>variants.item:0: Required fields were not provided: id, title</p> on 1767 in /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-api.php 2020-01-22T13:33:00+00:00 ERROR order_submit.error :: addStoreOrder :: 1863 :: Error Code 400 :: A product with the provided ID does not exist in the account for this list. on 1775 in /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-api.php

As per Mailchimp support and other tickets I've tried the following, with the same result each time:

Any help would be very much appreciated!

ryanhungate commented 4 years ago

@JurianBoots thanks for reporting this. Do you by chance have a lot of deleted products, or products that have been trashed, or put into draft mode for some reason? You're correct, this should not be a long sync at all, but since the orders seem to be having trouble associating a valid product, that is most likely the issue here. We've seen other reports of similar issues, and we're looking into this in our current dev cycle for pushing up 2.3.2 which will be coming up soon, just no guarantee on a timeline yet. We would be happy to help you out with a possible solution temporarily, but it would require editing a php file in your plugin. Can you please let us know if you have private or trashed or draft products that had been ordered in the past ( these 400 you speak of )? We might have a solution for you if you do.

JurianBoots commented 4 years ago

@ryanhungate Thank you for getting back to me. Indeed there are a lot of orders for products that have since been put on private or draft. I'm not uncomfortable editing a php file so if there's a possible solution there that would be very helpful!

ryanhungate commented 4 years ago

Change this line and this line to: 'post_status' => array('private', 'publish', 'draft'),

This should fix your issue on the next sync... so what we'll have to do is alter those two lines, and then go back to your plugin admin, to the Mailchimp plugin page -> then add in &resync=1 to the url. Click ( enter or return ) on your keyboard... that will push up a button that will allow you to Force Resync your data without disconnecting the plugin. I think we can start there and let us know if that handles the problem you're experiencing :)

JurianBoots commented 4 years ago

Hi Ryan! Thanks for your suggestion and for taking the time to help me with this :)

After editing the lines as per your instructions all 39 products were recognized and my audience list started to be populated with the customers and orders (woohoo!).

However the synced stop at about 1/3rd of the way. The last couple of logs only state:

2020-01-28T08:32:51+00:00 NOTICE order_submit.success :: addStoreOrder :: [Last successfully synced order] 2020-01-28T08:32:51+00:00 NOTICE action_scheduler.queue_job :: MailChimp_WooCommerce_Process_Orders starts in the next minute 2020-01-28T08:32:51+00:00 DEBUG MailChimp_WooCommerce_Process_Orders@handle :: queuing up the next job

No idea how to start debugging this further. I did try a resync a couple of times but it stopped at the same (103rd) order every try. There are currently 99 contacts in my Mailchimp audience.

Any suggestions?

JurianBoots commented 4 years ago

Adding to this:

I found that under Tools > Scheduled Actions there is a PHP fatal error occuring. Sounds worth investigating! :) I've copied the error below:

unexpected shutdown: PHP Fatal error Uncaught Error: Call to undefined method WC_Order_Refund::is_paid() in /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php:423 Stack trace: #0 /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php(240): MailChimp_WooCommerce_Transform_Orders->getCustomerOrderTotals(Object(WC_Order_Refund)) #1 /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php(87): MailChimp_WooCommerce_Transform_Orders->buildCustomerFromOrder(Object(WC_Order)) #2 /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php(42): MailChimp_WooCommerce_Transform_Orders->transform(Object(WP_Post)) #3 /var/www/runari-brubbekka/wordpress/current/wp-conte in /var/www/runari-brubbekka/wordpress/current/wp-content/plugins/mailchimp-for-woocommerce/includes/api/class-mailchimp-woocommerce-transform-orders-wc3.php on line 423

I hope that might have been helpful to share. It seems it has something to do with refunds?

ryanhungate commented 4 years ago

@JurianBoots so - yes, that does look like something which needs to be looked at. We did not experience this ourselves, and it makes me wonder what version of Woo you're currently on? Do you mind adding your Woo system report here so we can take a peek? Of course there is a way for our plugin to detect this and skip it, so we'll look into that on the next release cycle. For now, we might need to do some manual adjustments on your plugin in order to fix this for you temporarily.

If you would like me to do that for you - it's not problem, just make me a temporary admin - and send the invite to ryan (at) vextras.com and i'll get that handled for you.

JurianBoots commented 4 years ago

@ryanhungate Sure, please find the report below. I'm not sure I'm allowed to add temporary admins actually - would it be hard to do ourselves with some guidance?

I'm on Woocommerce 3.9.0. I did see there was a database update available, so I'll take care of that first thing in the morning and try another resync afterwards.

`

WordPress Environment

WordPress address (URL): https://runari-brubbekka.savviihq.com Site address (URL): https://runari-brubbekka.savviihq.com WC Version: 3.9.0 REST API Version: ✔ 1.0.6 Log Directory Writable: ✔ WP Version: 5.3.2 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: –

Server Environment

Server Info: nginx/1.13.6 PHP Version: 7.3.2 PHP Post Max Size: 64 MB PHP Time Limit: 120 PHP Max Input Vars: 3000 cURL Version: 7.60.0 OpenSSL/1.0.1e

SUHOSIN Installed: – MySQL Version: 5.6.43 Max Upload Size: 64 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔

Database

WC Database Version: 3.8.1 WC Database Prefix: wp_ Total Database Size: 54.96MB Database Data Size: 51.15MB Database Index Size: 3.81MB wp_woocommerce_sessions: Data: 0.05MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_api_keys: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_order_items: Data: 0.09MB + Index: 0.06MB + Engine MyISAM wp_woocommerce_order_itemmeta: Data: 0.93MB + Index: 0.50MB + Engine MyISAM wp_woocommerce_tax_rates: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_aelia_dismissed_messages: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_aelia_exchange_rates_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commentmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_comments: Data: 0.70MB + Index: 0.34MB + Engine MyISAM wp_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mollie_pending_payment: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 1.07MB + Index: 0.09MB + Engine MyISAM wp_postmeta: Data: 40.37MB + Index: 1.64MB + Engine MyISAM wp_posts: Data: 6.98MB + Index: 0.30MB + Engine MyISAM wp_pum_subscribers: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_redirection_404: Data: 0.05MB + Index: 0.06MB + Engine InnoDB wp_redirection_groups: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_redirection_items: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_redirection_logs: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_termmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_terms: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_term_relationships: Data: 0.02MB + Index: 0.03MB + Engine MyISAM wp_term_taxonomy: Data: 0.00MB + Index: 0.01MB + Engine MyISAM wp_usermeta: Data: 0.54MB + Index: 0.32MB + Engine MyISAM wp_users: Data: 0.02MB + Index: 0.02MB + Engine MyISAM wp_wcpdf_credit_note_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpdf_invoice_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpdf_packing_slip_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpdf_proforma_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_download_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM wp_yoast_seo_links: Data: 0.02MB + Index: 0.01MB + Engine MyISAM wp_yoast_seo_meta: Data: 0.01MB + Index: 0.02MB + Engine MyISAM

Post Type Counts

attachment: 512 custom_css: 2 elementor_library: 26 nav_menu_item: 58 oembed_cache: 5 page: 43 popup_theme: 6 post: 40 product: 39 product_variation: 50 revision: 1122 scheduled-action: 486 shop_coupon: 83 shop_order: 557 shop_order_refund: 69

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (3)

Mailchimp for WooCommerce: by Mailchimp – 2.3.1 – Not tested with the active version of WooCommerce TheElementor: by Elementor.com – 1.5.9 WooCommerce: by Automattic – 3.9.0 – 3.9.1 is available

Inactive Plugins (25)

(Simply) Guest Author Name: by Shoofly Solutions – 4.10 Advanced Order Export For WooCommerce: by AlgolPlus – 3.1.1 – Not tested with the active version of WooCommerce Aelia Foundation Classes for WooCommerce: by Aelia – 2.0.12.200101 Classic Editor: by WordPress Contributors – 1.5 Convert Plus: by Brainstorm Force – 3.5.1 Duplicate Post: by Enrico Battocchi – 3.2.4 Enhanced E-commerce for Woocommerce store: by Tatvic – 2.3.0 – Not tested with the active version of WooCommerce GDPR Cookie Consent Banner: by termly – 2.3.15 Intercom: by Intercom – 2.6.3 Invisible reCaptcha: by Mihai Chelaru – 1.2.3 Mollie Payments for WooCommerce: by Mollie – 5.4.2 – Not tested with the active version of WooCommerce Order / Coupon / Subscription Export Import Plugin for WooCommerce (BASIC): by WebToffee – 1.5.7 – Not tested with the active version of WooCommerce Redirection: by John Godley – 4.6.2 SendCloud | Smart Shipping Service: by SendCloud B.V. – 1.1.1 W3 Total Cache: by BoldGrid – 0.12.0 Warpdrive: by Savvii support@savvii.com – 2.10.2 WC Duplicate Order: by Jamie Gill – 1.7 – Not tested with the active version of WooCommerce WooCommerce Email Test: by RaiserWeb – 1.10 – Not tested with the active version of WooCommerce WooCommerce EU VAT Assistant: by Aelia – 1.12.3.200101 WooCommerce Intercom Integration: by Ektagon Platforms – 1.10.0 – Not tested with the active version of WooCommerce WooCommerce PayPal Checkout Gateway: by WooCommerce – 1.6.18 – Not tested with the active version of WooCommerce WooCommerce PDF Invoices & Packing Slips: by Ewout Fernhout – 2.4.3 WooCommerce PDF Invoices & Packing Slips Premium Templates: by Ewout Fernhout – 2.5.6 – Not tested with the active version of WooCommerce WooCommerce PDF Invoices & Packing Slips Professional: by Ewout Fernhout – 2.2.3 – Not tested with the active version of WooCommerce Yoast SEO: by Team Yoast – 12.9.1

Must Use Plugins (1)

eol_php_mu_plugin.php: by –

Settings

API Enabled: ✔ Force SSL: – Currency: EUR (€) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: external (external) grouped (grouped) simple (simple) variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5)

Connected to WooCommerce.com: –

WC Pages

Shop base: #930 - /shop/ Cart: #48 - /cart/ Checkout: #49 - /checkout/ My account: #50 - /my-account/ Terms and conditions: #159 - /terms/

Theme

Name: Twenty Nineteen Version: 1.4 Author URL: https://wordpress.org/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔

Templates

Overrides: –

Action Scheduler

Complete: 473 Oldest: 2019-12-31 08:42:20 +0000 Newest: 2020-01-28 22:48:52 +0000

Pending: 1 Oldest: 2020-02-04 22:48:52 +0000 Newest: 2020-02-04 22:48:52 +0000

Canceled: 3 Oldest: 2020-01-14 09:56:30 +0000 Newest: 2020-01-16 14:55:03 +0000

In-progress: 0 Oldest: – Newest: –

Failed: 9 Oldest: 2020-01-14 10:18:11 +0000 Newest: 2020-01-28 09:17:47 +0000

`

JurianBoots commented 4 years ago

@ryanhungate I've updated Woocommerce to 3.9.1 and tried to resync, unfortunately with the same result.

ryanhungate commented 4 years ago

@JurianBoots i'll be more than happy to log in and see if I can spot something for you if you add me in as an admin. So far, nothing really stands out that's incorrect, so I would assume that we might need to dig fairly deep into the fatal logs and maybe even alter the plugin a bit to get things working correctly.

ryanhungate commented 4 years ago

@JurianBoots just wanted to ping you again now to see if we could get that admin account created. Be more than happy to see if we can help. We've spotted this error in other installs, and there is a temporary fix that we can issue to your plugin to get the sync to continue. Please let us know if that's an option, otherwise we'll have to hold off until the next 2.3.2 release comes out to the public.

ryanhungate commented 4 years ago

@JurianBoots we have some patches that will be released in our next version 2.3.2 sometime this week. I'll close this out because we have this in our QA process now. When you see the update is available, go ahead :)

JurianBoots commented 4 years ago

Hi Ryan, sorry for not replying sooner but that's perfect, I'll try out the new version when it is released :) looking forward to it!

Thanks for all your help so far.

JurianBoots commented 4 years ago

Just dropping in a final comment here saying the latest update solved this problem and the sync is now complete.

Thanks again!

ryanhungate commented 4 years ago

@JurianBoots that's good news, great to hear! If you have a minute to spare, if you could please give our plugin a fair review on the wordpress plugin page that would be much appreciated. We're trying very hard to get things right for store owners like yourself and the reviews explaining solutions to problems are very positive in this ecosystem :)