Skip Navigation

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 8 replies, has 2 voices.

Last updated by Dražen Duvnjak 2 years, 11 months ago.

Assisted by: Dražen Duvnjak.

Author Posts
May 13, 2021 at 6:41 pm #8760203

Mylene

The website is English translated to French, and uses WPML for translations, and WPML WooCommerce Multilingual for translating products.

2 questions, but I suspect same answer:

1) When we update a product in English, we then have to go to WPML WooCommerce Multilingual to update translation of said product. That is the expected behavior if we change the description, for example. It works well.

But when we change the price of a product in English (or stock quantity), it should be the same in French no matter what, we still have to go to WPML WooCommerce Multilingual to update product, even though the product there still show the pen icon (instead of the turning arrow icon indicating it should be updated), or else it shows the old price (or old stock quantity) in French.

Is this normal behavior?

If not, how to automate?

Which brings me to

2) We have synced WooCommerce to Quickbooks (used in store). When the inventory changes in store, it updates the WooCommerce stock quantity automatically. This works-in English. The French stock quantity is not updated. So you end up with product BETA having 0 stock (sold out) in English but still displaying 12 stock in French, therefore overselling. This is a problem.

Is there a workaround this?

How to update prices and stock quantities automatically in French?

May 13, 2021 at 7:36 pm #8760407

Mylene

Some updates:
- I am NOT using multi currency, just one currency (CAD) and we only ship to one country (CANADA)

- I see reading other tickets that prices and stock should automatically be updated in French! Not the case here with WPML WooCommerce Multilingual (in fact my client was complaining about it), and has never been!
Please point me to the right SETTINGS to make this work?
Could using a variations plugin affect this? (most products have variations)

- For Quickbooks, I will try to add code found here https://wpml.org/forums/topic/how-to-properly-change-stock-level-in-code-that-will-be-synced/

What do you think about this:

// original line in plugin:
wc_update_product_stock($wc_product_id,$QtyOnHand);
// addon code starts here
/* Use the TRID to find the translated Product ids */
$trid = $sitepress->get_element_trid( $id, 'post_product' );
if (is_numeric($trid)) {
$translations = $sitepress->get_element_translations( $trid, 'post_product' );

if (is_array($translations)) {
/* Loop through each existing translation */
foreach ($translations as $translation) {
if ( !isset($translation->element_id) || $translation->element_id == $id) {
continue;
}
/* set the stock status and quantity in the translated by updating the post-meta info */
update_post_meta($translation->element_id, '_stock', $new_quantity);
wc_update_product_stock_status($translation->element_id, $QtyOnHand);
}
}
}
// addon code ends here

May 17, 2021 at 7:51 am #8776935

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello!

Welcome to WPML Support.

I'll do my best to help you solve this issue.

Let me start by pointing out we limit 1 issue per 1 ticket to keep things clear and easy to follow. I will reply to your 1st question and concentrate on 2nd issue with stock, not syncing across language. If you have any other doubts about1st one please open a new ticket for it and we will be glad to help out.

1) It really depends, depending on the complexity of products and how are you changing price ec. But yes it is recommended and in most cases, your will need to click to update the translations, and in my opinion, I think it should change the icon to arrows, not pencil.

2) Let's start debugging this issue by clarifying few things. How are you syncing QuickBooks and WooCommerce in the default language?

I see you are using the next plugin "WooCommerce Sync for QuickBooks Online - by MyWorks Software", which I do not see on our list of compatible plugins. Are you using this plugin, have you checked with the plugin author if this plugin can work with WPML?

List: https://wpml.org/plugin/?wpv_view_count=120064&wpv-plugin-functionality=0&wpv_post_search=QuickBooks&wpv_filter_submit=Search

On our list, I only see WooCommerce QuickBooks Connector Pro.

Please let me know.

Thanks,
Drazen

May 17, 2021 at 6:10 pm #8783497

Mylene

Apologies, but this does not answer or help?
Forget about 2) Quickbooks.
Please just answer this:
- If I change a price (or a stock quantity) in a Product and press Save (in English), is the price (or stock) updated in French as well - automatically?

May 18, 2021 at 6:25 am #8786059

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

if your website's default language is English and the product's default language is English, yes it should automatically update and sync it with the translated product.

If you have an issue with it, I would first suggest checking it in a minimal environment, only WPML plugins and WooCommerce active while using WP default theme.

Let me know how it goes.

Thanks,
Drazen

May 18, 2021 at 2:06 pm #8791563

Mylene

Yes - I have an issue with it. As described in first message, it does not update automatically.
I do not think it is a bug, but a setting. Which is why I also asked if you could list settings related to that, and how they should be for it to have a normal behavior.
For example:
In WPML Settings > Post Types Translation > Products (product) is now set to Translatable - use translation if available or fallback to default language.
Is this how it should be to update automatically?
Or should I look in Theme and plugins localization > Strings in the plugins > WooCommerce Multilingual?

May 18, 2021 at 2:22 pm #8791979

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello Mylene,

thanks for getting back and providing an informative reply.

There are no settings that can affect the stock sync in such a way as you described, nor this is changed anywhere.

The only other thing causing it could be if translation settings for the stock custom fields are changed from default values to something else.

Please go to WPML > Settings > Custom Fields Translation ​> Click "Show system fields" and search for stock. Make sure it is set to Don't translate. Please check and compare other values with the image attached.

If these settings are okay, I would suggest following my advice from the previous reply and checking fit the issue happens in a minimal environment.

Please let me know how it goes.

Thanks,
Drazen

Screenshot_1.jpg
May 18, 2021 at 4:01 pm #8793131

Mylene

This is the answer I was looking for!
HOWEVER my settings look exactly like your screenshot so that is not the problem, but thanks for pointing me there.

I will try with minimal environment,
but in the meantime
can you confirm the best way of manually updating stocks AND prices in French?
Is it WooCommerce Multilingual > Status > Troubleshooting
Sync variables products?
If you look at my screenshot, you see 325 left...
- Is this normal behavior?
- Is it that WPML auto updates prices on SINGLE product, but not on variations?

cap8.jpg
May 19, 2021 at 6:07 am #8795953

Dražen Duvnjak
Supporter

Languages: English (English )

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

Hello,

okay, great let me know how it goes.

As for the Troubleshooting tool, yes that is normal, that number will always reset to a number of possible products where this can be fixed, not products that need to be fixed, so no worries.

You can try using the "Sync product stock quantity and status" and "Fix translated variations relationship" options.

But if it doesn't work when you update the default language product, it might not work in this way also.

Please let me know how your testing on minimal goes.

Thanks,
Drazen

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