Answer the question
In order to leave comments, you need to log in
Custom variations for Woocommerce?
According to the standard in wokomers, variations are displayed as selects. But my design has a slightly different appearance:
I decided to hide the default selects and change the default ones by clicking on custom ones, using this "noodle":
jQuery('.colors-list li').on('click', function(event){
if(!jQuery(this).hasClass('active')){
//change active square
jQuery('.colors-list .active').removeClass('active');
jQuery(this).addClass('active');
//change active color label
var colorName = jQuery(this).attr('colorname');
jQuery('.checked-color').html(colorName);
//change value of hided woocommerce variable switcher
var colorSlug = jQuery(this).attr('colorval');
jQuery('#pa_color').val(colorSlug).change();
jQuery('.variations_form').trigger('woocommerce_variation_select_change');
}
});
Uncaught TypeError: Cannot read property 'length' of nullin the add-to-cart-variation file when checking:
if ( $( this ).val().length === 0 )
Answer the question
In order to leave comments, you need to log in
I found the Woocommerce Radio Buttons plugin and made it by analogy
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question