I have created custom template for single product. But the images are not changing according to variations such as default woocommerce functionality.
<div class="variation_images">
<?php
wc_get_template('woocommerce/single-product/product-image.php');
woocommerce_show_product_images();
?>
</div>
/*below code of variations which is working fine with its
related price and other attributes:*/
<?php
$get_variations = sizeof( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 20, $product );
wp_enqueue_script( 'wc-add-to-cart-variation' );
// Load the template
wc_get_template( 'single-product/add-to-cart/variable.php', array(
'available_variations' => $get_variations ? $product->get_available_variations() : false,
'attributes' => $product->get_variation_attributes(),
'selected_attributes' => $product->get_variation_default_attributes()
) );
do_action( 'woocommerce_after_add_to_cart_form' ); ?>
</div>