I'm using the below code for my store single page sidebar, I set image by variation name (type-2).
function image_by_variation() {global $product;if ( ! $product->get_attribute( 'type-2' )) return;echo '<div class="var_img"><img src="image1" height="200" width="500"></div>';}
screenshot - https://prnt.sc/o__rry_OT4g5 Now my type-2 variation has two items,
- repaired
- never-repaired
I want to change the image banner by variation. Becouse I will select only one variation for one product. some time (repaired) sometimes (never repaired)
Like--> if select repaired (image1), or select never-repaired (image2)