This thread is resolved. Here is a description of the problem and solution.
Problem: You are trying to translate products using WPML, but encounter issues where the translated product shows a stock of zero, you cannot modify the stock, and adding translated products to the cart results in an empty cart. Solution: We found that the issue was due to multiple _stock entries in the database for the translated version, with one entry having a NULL value. This was likely caused by a custom code snippet intended to force stock levels. To fix this, we edited the database entries to ensure all translations have correct _stock values and deactivated the problematic code snippet. We recommend you test again to see if you can now add the translated products to the cart correctly.
If this solution does not resolve your issue or seems outdated, please check the related known issues and verify you have the latest versions of themes and plugins installed. If problems persist, we highly recommend opening a new support ticket at 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.
Background of the issue:
I am trying to translate my products on a site that is currently under development using WPML.
Symptoms:
When I translate a product that has stock, the translated version shows a stock of zero, and I can't modify it. Additionally, when I add any of the translated products to the cart, the cart remains empty and doesn't accept the products.
Questions:
Why does the translated product show a stock of zero?
Why can't I modify the stock of the translated product?
Why does the cart remain empty when adding translated products?
1.- Please increase the WP memory Limit. Minimum requirements are 128Mb: https://wpml.org/home/minimum-requirements/
You can add this to wp-config.php to increase WP memory:`
- Add it above the line /* That's all, stop editing! Happy blogging. */
You can double-check the WordPress memory limit in WPML -> Support
2.- Once the WordPress memory limit then follow these steps:
- Edit a product in the original language
- Make a small change in the content of the product, especially in the variations or the price
- Save the changes
- Update the translation
- Flush any cache memory that might exist
- Double-check if the issue has disappeared
Yes, I have edited all the previous products and it worked, but this is not a solution.
Every time I translate a product, I have to open the translated product and make any change for it to get its stock.
I have a huge number of products, and this solution is not practical.
1.- Please share a URL where the issue can be seen.
2.- Share the access credentials to the site in your next message, which I have set private. That way, I will be able to double-check the configuration and reproduce the issue.
3.- Are you creating these products manually or importing them?
Thank you very much for sharing this URL. I was able to reproduce the issue, and to solve it, I had to re-save the product manually in Arabic.
Do you authorize me to activate/deactivate plugins and themes to run further tests to isolate the cause of this issue? If you authorize me, please confirm you have created a full site backup that you can restore if necessary.
As an alternative, you can create a staging site (using WP Staging for free) with a copy of the production site where we can safely run all the tests.
I ran several troubleshooting steps, but the issue persists. Do you authorize me to create a copy of the site to escalate this ticket to our 2nd tier of support?