我为单品创建了自定义模板。但是图像并没有根据默认的woocommerce功能等变化而改变。
<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>