Default image which is different to varients.

phil_CM
Excursionist
72 1 1

Hi all. I am using the featured product section for some functionality of my site. What I am wanting to happen is that the default image that I set, (the large image on the product admin page) to show initially. This image is not used on any product varients so at the moment the image defaults to the first product varient.

Is there as way I can overide this initial image so that the image only changes once the user selects a new option?

0 Likes
phil_CM
Excursionist
72 1 1

OK so I am approching from a different angle. I have created a "dummy" varient and set it as the default with the image I want. I have set the varients as "Please Choose"

As it stands the customer can add this varient Please Choose to the cart.

Is it possible to hide the add to cart button if this option is selected. I have tried wrapping the follwoing around the add to cart button code which works initially but the button does not re-appear when other options are selected.

 

            {% if variant.id != 39748121231548 %}
          
                <div class="product-form__item product-form__item--submit">
                  <button type="submit"
                    name="add"
                    id="AddToCart-{{ section.id }}"
                    class="btn btn--full product-form__cart-submit{% unless current_variant.available %} btn--sold-out{% endunless %}{% if section.settings.enable_payment_button %} btn--secondary-accent {% endif %}"
                    {% unless current_variant.available %}disabled="disabled"{% endunless %}>
                    <span id="AddToCartText-{{ section.id }}">
                      {% unless current_variant.available %}
                      {{ 'products.product.sold_out' | t }}
                      {% else %}
                      {{ 'products.product.add_to_cart' | t }}
                      {% endunless %}
                    </span>
                  </button>
                  {% if section.settings.enable_payment_button %}
                    {{ form | payment_button }}
                  {% endif %}
                </div>
          
          {% endif %}

 Many thanks in advance any help/pointers appreciated.

0 Likes
phil_CM
Excursionist
72 1 1

What a noob! worked it out. I just changed this:

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

to this:

{% assign featured_image = product.featured_image %}
0 Likes