Skip to content Skip to sidebar

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.

Sun Mon Tue Wed Thu Fri Sat
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 7 replies, has 1 voice.

Last updated by Andreas W. 3 days, 13 hours ago.

Assisted by: Andreas W..

Author Posts
August 7, 2025 at 1:22 pm #17302700

lucasS-30

Background of the issue:
I am trying to manage stock on my website using WPML. I expected to see the same stock levels for the same products in all languages. The issue can be seen on this page: hidden link.

Symptoms:
The stock levels are not synced between languages. Specifically, Stock EN is 16, while Stock NL is 0.

Questions:
Why is the product stock not syncing between languages?
How can I ensure that stock levels are the same for all languages?

August 7, 2025 at 1:46 pm #17302817

lucasS-30

I forced the stock on the NL product using this snippet:

/*
* Force stock
*/

function force_stock_for_translated_product( $translated_id, $new_stock ) {
// Get the default language (usually 'en' or 'nl')
$default_lang = apply_filters( 'wpml_default_language', null );

// Get the original product ID in default language
$original_id = apply_filters( 'wpml_object_id', $translated_id, 'product', false, $default_lang );

// If original exists, update its stock
if ( $original_id ) {
update_post_meta( $original_id, '_stock', $new_stock );
wc_delete_product_transients( $original_id );
wc_delete_product_transients( $translated_id ); // Just to be sure
} else {
// If no link found, force update on translated product directly
update_post_meta( $translated_id, '_stock', $new_stock );
wc_delete_product_transients( $translated_id );
}
}

force_stock_for_translated_product(38060, 16);

This works; so why is WPML not syncing the stock level?

August 7, 2025 at 2:07 pm #17302873

lucasS-30

I changed the setting _stock from `don't translate` to `copy` and now the stock synces between languages when I save the product. What is the correct setting?

August 8, 2025 at 5:45 pm #17306126

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

Hello,

Usually, the field _stock should be set to "Not translate".

The following fields should be set to copy:

total_sales
_backorders
_downloadable
_download_expiry
_download_limit
_manage_stock
_virtual
_weight
_width
_price
_regular_price
_sale_price
_sku
_sold_individually
_stock_status
_tax_class
_tax_status

The field _purchase_note should be set to "Translate".

The following fields are by default set to "Not translate":

_wcml_average_rating
_wcml_rating_count
_wcml_review_count
_wc_average_rating
_wc_review_count

If you get an unexpected behavior using these default settings, then this might be due to custom code or a third plugin.

Best regards
Andreas

August 11, 2025 at 8:39 am #17308431

lucasS-30

Can you help me debug this? We are running of the shelf WooCommerce + WPML + Shoptimizer theme, no custom code.

What would be the downside of leaving it to copy, this seem to be working?

August 12, 2025 at 5:14 pm #17314417

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

I can only suggest using the recommended settings from my last comment. Any different setting could cause unexpected issues between WooCommerce and WPML.

August 13, 2025 at 6:42 am #17315572

lucasS-30

Sure I want to use this setting, but then the stock sync doesn't work.
So please provide some guidance and support in this matter.

August 13, 2025 at 4:19 pm #17318559

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

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

After adjusting the settings, you might need to update the translations of the products to sync the fields.

If this doesn't resolve the issue, I'd be happy to offer to take a closer look.

I would like to request temporary access (wp-admin and FTP) to the website to investigate the issue further.

The required fields are located below the comments section when you log in to leave the next reply. The information you provide is private, meaning only you and I can see and access it.

IMPORTANT
Please be sure to back up your website and database before granting us access.
If you can't see the "wp-admin / FTP" fields, your post and website credentials will be set to "PUBLIC." DO NOT publish the data unless you see the required wp-admin / FTP fields.

I may need to install a plugin called "All In One WP Migration" to create a copy of the website so I can investigate the issue further.

However, I would also be very grateful if you could provide a staging site or a copy of the website from your server for this purpose.

If you have any questions about creating such a staging site, you can consult your hosting provider. Please note that WPML must also be registered on this staging site at https://wpml.org/account/websites/.

If you are unable to provide such a copy of the website for testing, please let me know on this ticket.

The private reply form looks like this:
hidden link

Click "I still need assistance" the next time you reply.

Video:
hidden link

Please note that we are required to request this information individually on each ticket. We are not permitted to access any credentials that were not specifically submitted on this ticket using the private response form.