show 1st image as feature image on the product page instead of the variant image.

Hi all,

I want to display the feature image as the 1st image on the product page instead of the variant image, but unable to achieve the same as it is showing the variant image as the 1st image not the feature image(or first image which we have added in the product admin section).

I have tried previous suggestion that has given by @made4Uo on the forum and but it is not working as expected on the dawn theme 15.0, as it is not working for the product that has no variants.

Also I need to achieve the same for the collection page, as for some of the product on the collection page its showing the feature image, but if the first variant is sold out then it is not showing the variant image rather than the feature image.

Can you all please help how can I solve this issue?

@BSSCommerce-HDL @Made4uo-Ribe @Moeed @Dan-From-Ryviu @websensepro @sahilsharma9515

Hi @sahilrev Hopefully you have found the solution for this issue, if not then here is the code you can use to solve the issue of product page.


Please follow the steps:

  1. Login in shopify admin.
  2. Click on the Online Store.
  3. Then click on the button next to Customize in live Theme.
  4. Click Edit Code.
  5. Search theme.liquid in the code in left hand side in your theme.
  6. Add the following code in the bottom of the file above tag

Hopefully it will help you. If yes then Please don’t forget hit Like and Mark it as solution!

Best Regards

Sahil

Hi @sahilsharma9515 thanks for the code and for the help that you have offered. It worked for me.