skip to Main Content

Change image background color for woocommerce variation products. This works, but there's over 80 different colors any suggestions to make it faster

add_action( 'woocommerce_after_variations_form', 'switch_image_background_variable_colors' ); function switch_image_background_variable_colors() { wc_enqueue_js( " $('input.variation_id').change(function(){ if('' != $('input.variation_id').val()) { if($('#pa_color-631').val() =='white-010'){ $('.woocommerce-product-gallery figure').css('background-color', '#FFFFFF'); } else if($('#pa_color-631').val() =='signal-yellow-019'){ $('.woocommerce-product-gallery figure').css('background-color', '#E6A925'); } else if($('#pa_color-631').val() =='golden-yellow-020'){ $('.woocommerce-product-gallery figure').css('background-color', '#FCAA19'); } else if($('#pa_color-631').val() =='yellow-021'){ $('.woocommerce-product-gallery figure').css('background-color', '#FDC60C');…

VIEW QUESTION

jQuery ajax response time

I'm using a simple Ajax get method on local machine that providing to empty function in my server-side laravel code, and observe from browser network that response is returned randomly in from 250-500ms. Can't get any similar problem (if it's…

VIEW QUESTION
Back To Top
Search