Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client's team of developers has an automatic algorithm for updating products from a CRM system. They encountered an issue where prices and quantities in translated products are not automatically synchronized with the main language when using the

WC_Product::save()

method.
Solution:
We recommend using the REST API to update products, as it should synchronize correctly. Alternatively, the client can utilize the

save_post

or

update_post

hooks to trigger synchronization. We also suggest looking into syncing custom fields between products using their own hooks. For further reference, the client can check out a similar case:

If this solution does not seem relevant, please feel free to open a new support ticket in our forum for personalized assistance: WPML Support Forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 3 replies, has 3 voices.

Last updated by Dražen 1 year, 2 months ago.

Assisted by: Dražen.

Author Posts
December 15, 2023 at 2:01 pm #15073473

yanaL

Hi! We need technical support, as we are a team of developers.

And right away I say that we do not need prompts like "go to settings->click on the synchronization button", because we make an automatic algorithm for updating products from CRM system.

The products on our website are updated automatically from CRM system every night. But we have encountered the following problem - prices and quantities in translated products are not automatically synchronized with prices and quantities in the main language. Our Auto Update Algorithm uses WC_Product::save() method to save the product after price and quantity changes. But WCML does not synchronize the products when saving them in this way.

Perhaps you could suggest us a method or hook to synchronize the product with code. We will be very grateful!

December 15, 2023 at 3:38 pm #15074191

Laura
Supporter

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+01:00)

Hi,

thanks for contacting us.

Did you look at our API documentation?
https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/
https://wpml.org/documentation/related-projects/woocommerce-multilingual/wcml-hooks-reference/

December 15, 2023 at 4:30 pm #15075075

yanaL

Good afternoon! What exactly does the documentation say about product synchronization?

December 18, 2023 at 8:08 am #15080941

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I think my colleague wanted to say, that if you use REST API to update product it should work fine, or via some hooks.

As from our side, what I can share is that we fire sync on save_post / update_post hook, or you can use one of your hooks to sync custom fields between products,

Please check the next ticket for reference:
- https://wpml.org/forums/topic/update-wcml-products/

Regards,
Drazen