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 1 reply, has 2 voices.

Last updated by Nigel 1 year, 10 months ago.

Assisted by: Nigel.

Author Posts
July 24, 2023 at 12:50 pm #14089565

steffenD-11

Hi there!

I'd like to file a bug for the plugin "WooCommerce Multilingual & Multicurrency". We found that, when adding more than half the available stock of a product to the cart, then switching the language on the product page, then adding the same number of the same product (but translated) to the cart, the cart accepts the summed up product quantity despite exceeding the available stock quantity set for it. This leads to a bad user experience as the cart is not corrected automatically.

Steps to reproduce:
1. Visit hidden link
2. Add 7 shirts of size L to the cart
3. Switch to German in the top left corner
4. Again, add 7 shirts of size L to the cart

What we expect:
The cart should reject a quantity of 14 as only 9 shirts are available.

Actual behavior:
14 shirts are accepted in the cart and this can only manually be corrected. Warnings are displayed in the cart page and in checkout.

The function `wcml_check_on_duplicate_products_in_cart` seems to be the culprit. Here, the quantities of the original and translated products are simply summed up without checking against the stock quantity limit (woocommerce-multilingual/inc/class-wcml-cart.php:438).

We would like to request an update fixing this issue.

Thank you!

July 24, 2023 at 3:00 pm #14090763

Nigel
WPML Supporter since 02/2016

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

Hi there

I reviewed our internal tickets and found the developers of WCML discussed this previously and decided not to handle this case.

It is an unusual scenario. It is not so unusual for someone to shop in one language, then after adding items to a basket notice that other languages are available and to change language then continue shopping. The unusual part would be having added several items of one product to the cart, then changing language, to then go ahead and add more of the same product but in a different language to the cart.

And if a client were to do this, then no error occurs because a warning about the quantity if shown on the checkout page.

If you don't like that then I would recommend the setting to reset the cart when switching langauge (at WooCommerce > WooCommerce Multilingual & Multicurrency > Settings).