February 17, 2016 at 1:29 pm
Hi, this is a 2 part question related to product variations.
I have created a variable product, with images defined for each variation.
On the product page it is possible to show the image change as you select the different choices from the drop down variations
If I select Display variations as radio buttons instead of select box in the
product settings of the theme the images stop changing. (see screenshot #1)
radio buttons – select box bug
————————————————————————————-
Part 2 of question
I found a snippet of code to be pasted in functions file that enables selections to function on cat archive page (see image #2)
radio buttons – select box bug
——————————
//change variations on the category pages
if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
function woocommerce_template_loop_add_to_cart() {
global $product;
if ($product->product_type == "variable" && (is_product() || is_product_category() || is_product_tag())) {
woocommerce_variable_add_to_cart();
}
else {
woocommerce_get_template( 'loop/add-to-cart.php' );
}
}
}
However it does not change the image if either choice of category select or radio buttons is used.
I prefere the radio buttons layout is it posible for a hack. fix of this snipet of code to enable the image change on archive pages AND can you make the radio buton change images on product page.
Many thanks sorry for the long queston, regards Lee