How to get the WooCommercer product variation image
I am building a WooCommerce theme but I’m having trouble getting the featured image to change when the user selects a product variation.
I have set different featured images for each variation on the backend, and this is the function I’m using to call the product’s featured image.
What should I add to this function in order to grab the variation’s featured image instead of the overall product featured image?
function show_featured_image() {
global $product;
echo 'div class="product_fetured_image"';
echo 'div class="feautred_image"img src="' . get_the_post_thumbnail_url() . '"/div';
echo '/div';
}
Topic woocommerce-offtopic Wordpress
Category Web