Skip Navigation

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

Problem:
Is there support for WooCommerce REST API with WPML?

Solution:
The support for WC REST API was implemented into WCML 4.6.5

Relevant Documentation:
https://wpml.org/download/woocommerce-multilingual-multicurrency/?section=changelog

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.

This topic contains 23 replies, has 3 voices.

Last updated by enricoG-14 4 years, 8 months ago.

Assisted by: Andreas W..

Author Posts
May 27, 2019 at 2:51 pm

tommiB

I am trying to: update prices for variable product variations using Woocommerce rest api interface. Price is updated to the main language products, but not to translated products

Link to a page where the issue can be seen: hidden link This is the main language product
hidden link This is the translation

I expected to see:
Translation should have same price as the main language product

Instead, I got: Translation has different price

May 27, 2019 at 8:54 pm #3900871

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you for contacting the WPML Support Forum.

Please make a backup of your site and database.

Go to WooCommerce -> WooCommerce Multilingual -> Status and select the option Troubleshooting at the right bottom corner.

Complete the available tasks for syncronizing product stock and variables.

Let me know if this solved the issue.

Kind regards
Andreas

Troubleshooting.PNG
May 28, 2019 at 4:55 am #3902707

tommiB

Hi, yes, this will resolve it temporarily. But products are updated real-time many times a day, so it is not very efficient if it has to be done this way manually. This should work automatically. Is there a fix coming to this issue that the products would sync automatically?

May 28, 2019 at 6:32 pm #3909383

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Could you please verify if you followed the steps inside of this guide:

https://wpml.org/documentation/related-projects/woocommerce-multilingual/using-wordpress-rest-api-woocommerce-multilingual/

Let me know if there are further isssues with the content.

Kind regards
Andreas

May 29, 2019 at 6:17 am #3912069

tommiB

Hello! Yes this is how we basically do it. We have our own software that is the client. The problem is not when creating a new variable product and variations and their translations. Creating a new variable product with variants and the translations works ok. The problem is when price is updated to a variable product's variants that were previously created. Price is saved to main language product variations but not to the translated. So there is some kind of sync problem probably when updating product data for variants.

May 30, 2019 at 2:05 am #3919387

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you very much for clarifying the issue.

Could you please try to run the site in minimal setup to see if the issue persists?

Please disable any additional plugin and try to run the site with WooCommerce and WPML and its add-ons. If the issue disappears please start reactivating any plugins, or activate them in small groups. This way please verify at which points the issue appears again to indicate the plugin that is causing the issue.

Also please change to a default theme like TwentySeventeen if possible to see if the issue might be theme related.

Further, you could enable the wp-debug feature to see if there are any current PHP errors given.

Add the following to your wp-config.php file:

define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

The wp-config.php is located in your WordPress root directory. It’s the same file where the database configuration settings are. You will have to access it by FTP or SFTP in order to edit it.

If you open wp-config.php and that define statement is not there, you can add it right before this line:

/* That's all, stop editing! Happy blogging. */

Now please visit the sections of your site in regards to the issue on front end and backend. You will be able to see possible errors on inside of your wp-content folder. Look for a debug.log file and provide me the results.

More information about how to activate this feature you can find here:
https://wpml.org/documentation/support/debugging-wpml/

In case you will not find the time to investigate the issue please leave me anotification and I might try to create a Duplicator package for testing locally or we cvould offer to migrate the site to our test server.

Kind regards
Andreas

June 3, 2019 at 5:40 am #3939415

tommiB

Hi, thank you.
Now another issue came up in production, that product variant id: s have changed after creation. I have to take a look at that. Could that be connected to WPML?

Meanwhile, if you can make duplicator package and test if you can replicate that price not changing problem, it would be very helpful.

June 3, 2019 at 10:04 am #3941171

tommiB

Yes, I was also to replicate this second problem in the test environment and it seems is also connected to WPML. This happens also without updates from REST API. When I deactivated WPML plugins, this does not happen any more.

The problem is this

1. create a new variable product and variants from attrbiutes. Save as a draft
2. create a translation for the product from WooCommerce Multilingual
3. check what the variation id's were for the main language product (lets say 10,11,12,13)
4. go to Main language all products list --> Select bulk edit for the product --> Select publish --> ok
5. check the vatiations id's --> they have been changed (like 20,21,22,23)

We have a external table for product and their variant id's used for product updating via REST API. This is why we can't have the id's changing

June 3, 2019 at 5:49 pm #3945081

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Do I understand right, that those ID's are changing even if the site runs only WooCommerce and WPML plus add-ons and a default theme?

I would kindly like to ask you to recreate the issue on the following sandbox test site in order to escalate the issue to our compatibility team.

One Click Login: hidden link

In case you will not find the time to recreate the issue please install the necessary plugins and send me short notification.

Kind regards
Andreas

June 4, 2019 at 4:59 am #3947977

tommiB

Hi!

Yes, I was able to reproduce it there!

I created a test product with variants and translations in Finnish.
Variants ID:s for English product were originally: 19,20,21,22
Variants ID:s for Finnish product were: 24,25,26,27
I just saved it as a draft at this point.

Then, after making a bulk edit to the English product on the All Products site, the IDs for the English product's variants have been changed to: 28,29,30,31. In the edit I only changed product status to "Published"

Bulk editing the Finnish language product didn't cause IDs to change.

June 4, 2019 at 3:57 pm #3953507

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I have tried to recreate the issue but I can not find any issues. I can see that when I connected to the site that you did not finish the WooCommerce and WooCommerce MUltilingual Setup Wizard. Could you please test now again?

I have created various variable products on draft, assigned attributes and variables, edited prices, translated, and published.
The ID for the original product did not change at any test. Please take note that the translated product by default uses different IDs as those attributes are translations of the original attributes.

Could you please once more provide detailed steps to recreate the issue?

Kind regards
Andreas

product translated and published.PNG
new draft variable product.PNG
June 5, 2019 at 6:42 am #3957421

tommiB

Hi,

here are the steps in detail with images:
1. create a new variable product. Create new attributes or use predefined attributes.
2. create variations based on these attributes. Take a note of the variation's IDs
3. save the product as a draft
4. Go to WooCommerece Multilingual --> Products and add translation
5. translate the product, also the attributes to the translated product. Save & Close
6. Go to All Products page. Select the created product (main language) from the select box and choose Edit from the dropdown --> Apply
7. Set Status to Published --> Update
8. Open the product page and check the variations. IDs are not the same what was in step 2

It seems this happens only when doing publish from the All Produts page. If done from the product edit page, this does not happen. Problem is that customer has a lot of produts and it was easier to publish a lot of products at a time instead of one product at a time.

step8.jpg
step7.jpg
step6.jpg
step5.jpg
step4.jpg
step3.jpg
step2.jpg
step1.jpg
June 5, 2019 at 3:04 pm #3962193

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Thank you very much for your message.

I was able to recreate the issue. The attribute IDs indeed change when publishing the product with the bulk edit or quick edit option. As workaround I would advise you to use the publish option on the product editor instead, for the meantime.

I also can confirm that the issue only appears if WPML is active.

The issue has been escalated to ur compatibility team and I will be on contact with you as soon we can provide a workaround. The issue should be solved with the next update for WooCommerce Multilingual.

Kind regards
Andreas

June 6, 2019 at 10:07 am #3968011

tommiB

All right, thank you. Hope to see this resolved soon.

June 6, 2019 at 3:13 pm #3970169

Andreas W.
Supporter

Languages: English (English ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

I will get back to you as soon I am able to provide a workaround or receive news update a fix with the upcoming update.

Kind regards
Andreas

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.