How to set product main photo?

Highlighted
Tourist
7 0 1

Hi everyone!

I want to set the main photo of the product, but when the page with the product opens, the photo of one of the product options opens immediately.

2020-03-13_13-45-10.png

I found such a topic on the forum, my problem is also explained here, but the solution that they offer there does not suit me. the fact is that there they suggest editing product.liquid but in my file there is no that part of the code. I use a non-standard theme.

https://community.shopify.com/c/Shopify-Design/Display-main-image-not-first-variant-on-page-load/td-...

 

My product.liquid contains only 12 lines

{% section 'product-template' %}
<script>
  // Override default values of shop.strings for each template.
  // Alternate product templates can change values of
  // add to cart button, sold out, and unavailable states here.
  theme.productStrings = {
    addToCart: {{ 'products.product.add_to_cart' | t | json }},
    soldOut: {{ 'products.product.sold_out' | t | json }},
    unavailable: {{ 'products.product.unavailable' | t | json }}
  };
</script>
<div id="shopify-ali-review" product-id="{{ product.id }}"> {{ shop.metafields.review_collector.review_code }} </div>

Anyone have any ideas?

0 Likes
Highlighted
Shopify Partner
103 25 29

Hi,
Please open section "product-template" and try to change two things
1) find this one

 {% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}

change it to 

{% assign featured_image = product.featured_image %}

 2) find this one 

<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>

Change it to 

<option value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>

 if still getting the issue then please let me know the theme name, i will give you a correct one

For Design, Development and custom changes Hire Me.
If your problem solved then Like & Accept this Solution.
Email ID: technicalvishvas@gmail.com
1 Like
Highlighted
Trailblazer
229 1 42

Hi @VishvasMishra I added your code but it's not yet working. My theme is Minimal. 

Fyi, my product template uses a slightly different line:

<option {% if variant == product.selected_or_first_available_variant %} selected="selected" {% endif %} data-sku="{{ variant.sku }}" value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money_with_currency }}</option>

 If you have something else that I can try, I'd really appreciate it. 

0 Likes