Answer the question
In order to leave comments, you need to log in
How to optimize database calls when getting a product variation (selecting a product attribute)?
There are about 100 variations of one product
with two attributes of attribute
values 11 and 8
When you select any attribute (color or size), there is a hard stupidity ...
Apparently here to dig? By the way, not only in variations is stupidity, the site as a whole is stupid ...
Answer the question
In order to leave comments, you need to log in
There is another tricky moment regarding the options on the product page, which has more than 30 variations.
It is necessary to prescribe the maximum number yourself, otherwise there will be glitches / difficulties with the data requiring dynamic processing of the available variations.
add_filter( 'woocommerce_ajax_variation_threshold', 'wc_inc_ajax_threshold_more', 10, 2 );
function wc_inc_ajax_threshold_more($qty, $product) {
return 150;//или больше...
}
I found what the problem is with regards to variations. The product was exported incorrectly (without the id field) only with the article, and thus it added duplicated variations with the same attributes... That's stupid :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question