fbpx
Want To Add Extra Images Per Product Variation For Free? Download Now

Radio Attribute trying to show image

Bev Love

I’m updating an existing website (for a client) with a new design. And I’m using the Variation Swatches plugin to allow me to choose how the variation options are shown. It’s normally either as a select box or as radio buttons.

I’ve got it working fine for products with one particular attribute:
https://jw.tld-dev.co.uk/product/el-jaguar/

But for products with a different attribute, the radio is trying to show the image next to it – even though it is radio selected in the back end.
https://jw.tld-dev.co.uk/product/africa-kenya-pf1-tea/

Would really appreciate any suggestions.

Thanks,

Bev

Hakik Zaman

Hi Bev,

Thanks for reaching out to us. We have added more data for radio variation in our latest release.

Please add the below code using the Code Snippets plugin and check if it displays your desired output or not:

add_filter('woo_variation_swatches_global_item_radio_label_template', 'override_radio_display_parameter', 10, 2);
add_filter('woo_variation_swatches_variable_item_radio_label_template', 'override_radio_display_parameter', 10, 2);
function override_radio_display_parameter($template, $data){
   $new_label_template = apply_filters( 'woo_variation_swatches_global_item_radio_label_template_new', '%variation%', $data );
   return $new_label_template;
}

Thank You

Bev Love

Hi,

Thanks for sending through this code snippet – it has fixed the issue and is displaying the radio buttons without the image.

Thanks,

Bev