I have changed dropdown to radio button using wc-variations-radio-buttons-master The different color is also actually radio button.
The current link product have 12
such variation which have product and not other. Some combination I can explain such as Silver,Matching upholstery,VC,RegularSeat
and Silver,Matching upholstery,ACC,RegularSeat
have product while Silver,Matching upholstery,Regular,RegularSeat
have not product now i want to hide Regular
option from current scenario and all other such option which have not product
.
I meant to show those radio button which have product if not then hide irrelevant radio button
Product link
If I understand your question correctly, you want woocommerce to prevent users from selecting certain combinations of options on variable products, unless a variation with the selected options actually exists and is in stock?
This probably is due to the woocommerce_ajax_variation_threshold. If your product contains more variations than the threshold specifies, woocommerce will wait until all variation options have been selected by the user before determining if the selected combination of options is valid(in stock, exists, etc). If the user has selected a combination that is not valid or is not instock, you will get the
Sorry, no products matched your selection. Please choose a different combination
Say you had a product where you can set the following attributes:
upholstery, base, arms headrest, back
That is 5 different attributes. If each one of those attributes has 5 options, that is 25 different possible combinations assuming the user has to select all 5 options. If the user doesn't have to select all 5 options then there are even more possible combinations.
So even if you only actually created 2 variations for this product, its woocommerce_ajax_variation_threshold would be 25, meaning 25 possible options(variations).
I think by default the woocommerce_ajax_variation_threshold is set to 10.
So to fix(filter) this, set the woocommerce_ajax_variation_threshold to a higher value. If your product has 30 possible combinations(whether they actually exist or not) set the threshold to something higher than 30, like 1111 for example.
You can use the snippet below in your functions.php file.
/* Increase Woocommerce Variation Threshold */
function wc_ajax_variation_threshold_modify( $threshold, $product ){
$threshold = '1111';
return $threshold;
}
add_filter( 'woocommerce_ajax_variation_threshold','wc_ajax_variation_threshold_modify', 10, 2 );
Please check variation matrix table, for correctly matched select of all variants with each other....
Eg.
2x2 means 11 12 21 22
3x3
111 122 113 221 222 223 331 332 333
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With