Hello @rui9075918
Thank you very much for using our plugin.
To display a different image based on the choice selected in a radio button or dropdown field, you can use a calculated field as an auxiliary.
I’ll try to describe the process with a hypothetical example.
Assuming you have the radio button field fieldname1 with choices 1, 2, and 3, and you want to display the images: https://www.yourwebsite.com/image-a.png, https://www.yourwebsite.com/image-b.png, and https://www.yourwebsite.com/image-c.png, based on the choice selected:
Insert an “HTML Content” field in the form with the following tag as its content:
<div class="image-container"></div>
Insert a calculated field, that you can hide by ticking a checkbox in its settings, and enter the following equation:
(function(){
var image;
if(fieldname1 == 1) image = 'https://www.yourwebsite.com/image-a.png';
else if(fieldname1 == 2) image = 'https://www.yourwebsite.com/image-b.png';
else if(fieldname1 == 3) image = 'https://www.yourwebsite.com/image-c.png';
jQuery('.image-container').html('<img src="'+image+'">');
})()
Best regards.
Good afternoon,
But this image does not pass to the summary of the product. I intend to be able to pass the image to the summary of the product.
Even inserting a
Field Type: Medium, does not pass. Is any additional configuration required?
Hello @rui9075918
In this case you can returns the image URL from the equation:
(function(){
var image;
if(fieldname1 == 1) image = 'https://www.yourwebsite.com/image-a.png';
else if(fieldname1 == 2) image = 'https://www.yourwebsite.com/image-b.png';
else if(fieldname1 == 3) image = 'https://www.yourwebsite.com/image-c.png';
jQuery('.image-container').html('<img src="'+image+'">');
return image;
})()
And then, assuming the calculated field is the fieldname123 field, you can insert the following tag in the product’s summary:
<img src="<%fieldname123_value%>">
Please, note we are not allowed to support any customers in these forums, and the WooCommerce integration is a commercial feature.
For pro or commercial product support please contact us directly on our site. This includes any pre-sales topics as well.
Commercial products are not supported in these forums. We will happily answer this and any other questions you can have on our own site.
Thank you.