Variable products in different languages are added to the cart separately #361
Comments
Test site №2: |
Hi,
what problem are you experiencing? The plugin doesn't have a with variable products and the cart, this should normally work fine.
Note: Some plugins/themes could have code which interferes with the above process This plugin does have a special link to connect the variation translations, which depends on the variations being created in the shop base language, so if the variations were created when this plugin was not activated, or the shop base language was changed, then the system would have trouble finding the linked translation of the variation. |
Thank @Jon007, please see how it looks in the cart (as two products) Polylang switches products correctly, woo-poly translates the variation from the main language. Variable products are created with an active woo-poly. Translates variational products correctly, but adds them to the cart two products, as in the screenshot. I think public function addToCart ($ ID) does not handle variable products. I can not find the reason. What versions of WP, woo-poly, Polylang do you consider working with variational products? What are your recommendations for the versions? |
ok I see what you mean and can reproduce as follows:
This could be fixed by an extra check when adding to cart, check if the product to be added is a variation and any translation of this variation is already in the cart then increase the cart quantity instead of adding to the cart.. However I am not sure that the current behaviour actually causes any real problem does it? |
Yes, as you describe. Thanks, understood. If I write the handler code, I'll write to the post under my question. |
I'm still not exactly sure what the problem is or what solution you are proposing. if it's a book-keeping issue and you need all the orders/postings to refer to one language then that could be added to the book-keeping code (along the same principle as this plugin cart module does). Some people would prefer the cart module to be turned off for the sake of other plugins also modifying the cart. If we allowed that option, then products would either disappear from the cart when switching languages (you can only check out a product in the language you added it to the cart), or possibly always show the product in original language added to cart, regardless of checkout language. |
Hey, I am having the same issue. Have 2 languages on the site, any product has only 1 in stock. I am not sure if this is a bug or I just don't know how to handle it. Will be great to have suggestions to handle it. |
There are issues with stock, see #299 In this case the problem is not so much that the same client could add the product in different languages, the real problem is that a different client could add the stock in another language as the stock is not reserved across all languages. |
I looked at #299 and I don't think this is my problem. I just got an order on the site for the English product. The Spanish product is marked as 'out of stock' and the client is not able to add to cart/purchase this product. My problem is when the client adding an English item to the cart and on the same session, change the site language to Spanish, the client can add the same product (only in Spanish). |
My point is that if the same client can add the same product, then other clients can also add the same product, which is a more likely and troublesome scenario. |
Can you reproduce this issue on default Wordpress theme (eg Storefront)?
yes
Can you reproduce this issue when all other plugins are disabled except WooCommerce, Polylang and Hyyan WooCommerce Polylang Integration?
yes
What product versions and settings are you using when this issue occurs?
PHP: 7.1
WordPress: 4.7.11
WooCommerce: 3.4.4
Polylang: [state if using Polylang PRO] 2.1.5
Hyyan WooCommerce Polylang Integration: 1.2.0
Theme: Impreza (Child Theme)
Browser: Opera, Chrome, any
Steps to Reproduce
Add to cart variable products in different languages (Simple products are added to the cart correctly)
What I Expected
Variable products of the same type were added to the cart in different languages as one
Note: Variable products in these versions are translated correctly, in the additional language, data of product variations in the main language are blocked and activated. But duplicated when added to the trash.
What was done before:
There is a site where woo-poly does not work correctly with the translation of variations. Variations were blocked by woo-poly, Polylang combined multilingual versions correctly.
In the cart were various variable products with different variations.
Have installed a different version of WP. The recommendations of Fixes # 187 were implemented (also when updating). Variations are handled correctly, but variable products in different languages are added to the cart several times.
Possible actions, write your own handler add-to-cart-validation and add-to-cart-variable_product. There are doubts.
@Jon007, please, help mine.
The text was updated successfully, but these errors were encountered: