Featured image before variant image

Highlighted
Excursionist
50 1 4

I have tried to follow this tutorial https://shopify.dev/tutorials/customize-theme-show-featured-image-on-product-page but when I do it gets rid of any main image altogether and makes you click on an image to bring it up. 

 

All I want is for the featured image to show on the product page first and not the first variant. 

https://merchantsswanbourne.myshopify.com/ pw: viewme 

Theme: Brookyln 

 

Thank you!

0 Likes
Highlighted
Shopify Partner
1285 75 156

Dear Maddison,

 

1. In Shopify dashboard, go to Settings -> Files -> Upload your featured product image.
2. In product page dashboard, create a metafield named “featured” to store product featured image url, so we need to put something like this:
Namespace: global
Key: featured
Value: Name of featured product image that you’ve uploaded in the step 1.

3. To display featured product image in collection page, for example. You just need to edit product.liquid snippet file and put a script like this:

{% unless product.metafields.global.featured == blank %}
<img src=”{{ product.metafields.global.featured | asset_url }}” alt=”{{ product.title | escape }}”>
{% else %}
<img src=”{{ product.featured_image | product_img_url: ‘large’ }}” alt=”{{ product.title | escape }}”>
{% endunless %}

If you still need help please contact here: https://www.task4store.com/pages/contact-us

Thanks & Regards
MS Web Designer
Setup Shopify Store @ 129 USD
20000+ Task Completed
1000+ Satisfied Client
9.9*/10 Customer Rating
10*/10 Shopify Services Marketplace
0 Likes
Highlighted
Excursionist
50 1 4

Is there a way around this if all the featured products have already been listed? I have 100's + of products already with their images uploaded. The featured image is showing on the collections page but not on the product page on products that have variants. 

 

I'm guessing it might be something to do with this line?

 

{% assign current_variant = product.selected_or_first_available_variant %}
{% assign featured_media = current_variant.featured_media | default: product.featured_media %}

0 Likes
Highlighted
Shopify Partner
1285 75 156

Please contact here: https://www.task4store.com/pages/contact-us

Thanks & Regards
MS Web Designer
Setup Shopify Store @ 129 USD
20000+ Task Completed
1000+ Satisfied Client
9.9*/10 Customer Rating
10*/10 Shopify Services Marketplace
0 Likes