Support » Plugin: WooCommerce » Use a different image for the product page instead of the featured image

  • I spent a couple of hours trying to figure out the best way to do this (looked at various plugins etc) but this ended up being the easiest way and i thought id share it in case it can help someone else.

    when you dont want the catalog image (the featured image) being the main image shown on the product page (single shop image) i found by using the advanced custom field plugin, setting up an image ID field then adding the code below to the single-product / product-image.php woocommerce template file it worked fine (where shop_image is the name of the custom field)

    <div class="images">
    
    	<?php $image = wp_get_attachment_image_src(get_field('shop_image'), 'full'); ?>
    <img src="<?php echo $image[0]; ?>" alt="<?php echo get_the_title(get_field('shop_image')) ?>" />
    
    	<?php do_action( 'woocommerce_product_thumbnails' ); ?>
    
    </div>

    https://wordpress.org/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use a different image for the product page instead of the featured image’ is closed to new replies.