Home › Forums › WoodMart support forum › Use images from product variations limits
Use images from product variations limits
- This topic has 5 replies, 2 voices, and was last updated 4 years, 7 months ago by Artem Temos.
-
AuthorPosts
-
April 1, 2020 at 10:04 am #183766
tjchamParticipantHi, We have both your themes, and both have problems displaying the product variation images for the feature activated by “Use images from product variations”.
There appears to be hard limits set for when the variation image will show, and the themes behave differently.
In Basel there seems to be a max variation of 12 variations per attribute color to show the variation image… add 13 and it reverts back to the attribute name or preview color.
In Woodmart, there appears to be a limit of a total of variations of 30 variations of all attributes combined. 31 and it reverts back to name.
It easy to go past these limits with shoes… 13 sizes in half sizes per color is normal and several colour variations.
Where is the code set for these limits please?
Also:
In Basel the variation image will show even if the swatch preview color is set in the attribute – which is great, because sometimes you need just to use the color Swatch instead of the images… But in Woodmart the product variation image will only show if there is no color set for the attribute.
It is good to have the possibility to use both color preview or image because it saves duplicate attributes… One color attribute for the Swatch and one for the Variation image… and how do you name these or find them in the lists? (Red for Swatch, Red for Images ?) Can you not just make it like in Basel?
Thanks
April 1, 2020 at 10:33 am #183773
tjchamParticipantSome more testing….
So in Basel, maybe not 12 variations, but also looks like 30 Variations.Also in Basel, 30 Variations throws a PHP error.
Warning: Invalid argument supplied for foreach() in…/wp-content/themes/basel/inc/classes/Swatches.php on line 129
Woodmart not giving a PHP error after 30 variations.
April 1, 2020 at 11:24 am #183784
tjchamParticipantThis might be an ajax loading setting? I see from other plugins that it is possible to adjust this setting. 30 seems like a default, more than 40 gives page load performance issues.
April 1, 2020 at 11:42 am #183797
Artem TemosKeymasterHello,
Try to add the following PHP code snippet to the child theme functions.php
function custom_wc_ajax_variation_threshold( $qty, $product ) { return 150; } add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 );
This will increase standard WooCommerce variations number to be loaded with AJAX from 150.
Kind Regards
April 1, 2020 at 12:45 pm #183820
tjchamParticipantGreat thank you.
Yes. Works well… Sorry that we thought this was a theme issue and not a Woocommerce issue. Thanks for the fix.
However, when moving over to WoodMart we now have to duplicate our color attributes as they all had the swatch preview set, but for some products and use the color swatch is preferable. Was there a reason for coding Woodmart to not show attribute image if swatch color is set?
April 1, 2020 at 5:27 pm #183834
Artem TemosKeymasterSorry, what do you mean by that? Could you please send us some screenshots and link with example?
-
AuthorPosts
Tagged: Attributes, swatches
- You must be logged in to create new topics. Login / Register