-
Notifications
You must be signed in to change notification settings - Fork 67
Weird variations behavior: duplicates #430
Comments
@dancs2520 A couple of things first:
I do notice that disabling a variation doesn't synchronise the disabled property and we don't have an option for that, but as per my initial comment, no one has raised that before... |
Ok I have reproduced this. |
@Jon007, since I already had the attribute created, I didn't even tried to reproduce the issue with a new one created directly from the products.. Sorry about that. Ps.: the reason we have this variation disabled is that we have some products in stock, but we still can't sell them due to some legal issues.. We plan to just enable them as soon as such issues are solved. |
Enabled isn't currently compatible with with plugin's copying of variation meta because there is no 'Enabled' meta, instead it is saved directly as the post status of the variation, as per the woocommerce implementation:
Since the posts are private, calls like get_posts() used in Variation.php to find the translated variations will fail, because get_posts() adds an implied filter for only published posts, unless another status is specifically requested: a fix may well be to add |
@dancs2520 , I have checked in a fix which is limited to the Variation.php file - if in doubt just use this version of the Variation.php file. There is not an option to not synchronise the Enabled status, and if needed that would need to be logged as a separate issue for enhancement request which would need some thought as to what happens in the shopping cart etc if you change languages whilst shopping... (by default, if the translation is not available in target language, the original language would be shown, items are not removed from the basket due to missing or unavailable translations). |
I am sorry to write here, but i got similar problem with variation duplication for variable products. I tried creating translated product via 3 ways:
In all 3 ways , product variations in translated product are doubled. On original product i have 5-7 attributes, only 1 of them is used for variations(it has 2 values), so variations are only two, on translated product - 4 If i open original product and click update - it double all variations for translated product - makes it 8 - 16 - 32 etc |
Same. As i click update on the product in other language it duplicates the variation attributes. it doubles it eveytime i update the product. |
confirmed, the fix is no longer working with latest plugin and wp versions |
get_posts() in variation.php duplicate() doesn't work because the query is hooked by Polylang such that translated variations are never found: Polylang add a wp query filter by language on the 'wrong' language for this context, besides which this plugin never used to assign language to the variations only the parent variable product. Since no translation is found the code creates new translated variations as often as it is called. Other instances of variation lookups were switched to use getRelatedVariation() which avoids the polylang hooks by avoiding wp_query in favour of more direct query for all related variations (independently of language). This can also be addressed by adding 'lang' => '', to the wp query parameters, Polylang allows this as a way of querying across languages. |
Hello, i have the same problem.I have main language(greek) and secondary(english) set on my shop. Every time i update a product, it duplicates the secondary language product variations. Any solutions there? |
@charalampospapadop yes, these are the solutions checked in this week, please try from the latest source code if you can and report any issues with that. |
@Jon007 Thank you for replying. By latest source code did u mean the Variation.php u shared if so i already tried that and it didnt work for me. I am on WordPress 5.3.4, WooCommerce 4.9.2 also got the latest versions of Hyyan and Polylang. |
@charalampospapadop there are also changes to variable.php and to the .js files in public/js |
@Jon007 Thanks a lot for the instructions, i am new to Github and sorry. Seems to work fine the only thing is that when i translate the product first time before i publish it , it does not show the variable products, then i publish it but they still wont show, i had to do 1 extra update after the publish, then they showed up. Thanks again. |
@Jon007 I have the same problem WP Version 5.7.2, Woocommerce Version 5.3.0, Polylang Version 3.0.4 , Hyyan Version 1.5.0. |
@mkaramp please try 1.5.1 as there were some significant corrections to the hooks used for synchronisation: |
@Jon007 You re the best, problem solved. Thank you! |
@hyyan maybe we should release 1.5.1 to Wordpress.org |
I have some products with variations. Among such variations, some are not "Enabled" at this moment. When I go to the edit page of a product in the second language (JP), I see that every one of the "disabled" variations appears quadruplicated. For example: I have S, M, L, XL sizes, and S and XL are not enabled. In the JP version, I see S, S, S, S, M, L, XL, XL, XL, XL.
notes: 1) if I click Update, even more extra variations appear;
2) I can remove the extras, as long as I don't Update;
3) This happens only with the disabled variations;
4) all the extras share the same SKU
5) the problem appears to somehow be similar to #418
6) I have tried fresh with new products and the problem persist
What product versions and settings are you using when this issue occurs?
Steps to Reproduce
What I Expected
That the variations appear like in the case with Enabled products, just one per original variation.
Also, that the Update button don't aggravate the problem
What Happened Instead
I am getting many extra variations
Copy and paste the system status report from WooCommerce > System Status in WordPress admin here.
The text was updated successfully, but these errors were encountered: