When a different variant is selected, the default variant is added to cart

Highlighted
Excursionist
29 0 3

Hi guys, Dave here at UK Aspire vendor (www.ukaspirevendor.co.uk).

We have an issue with variant selection in our store.

Whenever a customer selects a different variant within a product and adds that to their basket, the default variant is added instead.

You can test this by clicking on this product and choosing the 20mg variant.

I would suspect that this is down to some code which hides the quantity selector and add to cart button depending on product tag.

At present, the buttons become available when the product is tagged with 'InStock, LOWSTOCK, & PRE-ORDER'

 

I would really appreciate some help here if someone would be so kind.

 

Here is the full code for our product listing:

 

{%- comment -%}

----------------------------------------------------------------------------------------------------
THIS IS THE PRODUCT WHEN VIEWED AT PRODUCT LEVEL
----------------------------------------------------------------------------------------------------

{%- endcomment -%}


{%- assign selected_variant = product.selected_or_first_available_variant -%}

<div class="card {% if product.media.size > 0 %}card--collapsed{% endif %} {% if template.name == 'product' %}card--sticky{% endif %}">
{%- if section.settings.enable_image_zoom -%}
<div id="product-zoom-{{ section.id }}" class="product__zoom-wrapper"></div>
{%- endif -%}

<div class="card__section">
{% comment %}
------------------------------------------------------------------------------
PRODUCT META
------------------------------------------------------------------------------



{% endcomment %}

{%- if section.settings.show_share_buttons -%}
{%- capture share_buttons -%}
{%- assign share_url = shop.url | append: product.url -%}
{%- assign twitter_text = product.title | url_param_escape -%}
{%- assign pinterest_description = product.description | strip_html | truncatewords: 15 | url_param_escape -%}
{%- assign pinterest_image = product.featured_media | img_url: '1024x' | prepend: 'https:' -%}

<ul class="social-media__item-list list--unstyled">
<li class="social-media__item social-media__item--facebook">
<a href="https://www.facebook.com/sharer.php?u={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.facebook_share' | t }}">{%- render 'icon', icon: 'facebook' -%}</a>
</li>

<li class="social-media__item social-media__item--pinterest">
<a href="https://pinterest.com/pin/create/button/?url={{ share_url }}{% if pinterest_image != blank %}&media={{ pinterest_image }}{% endif %}&description={{ pinterest_description }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.pinterest_pin' | t }}">{%- render 'icon', icon: 'pinterest' -%}</a>
</li>

<li class="social-media__item social-media__item--twitter">
<a href="https://twitter.com/share?{% if twitter_text != blank %}text={{twitter_text}}&{% endif %}url={{ share_url }}" target="_blank" rel="noopener" aria-label="{{ 'general.social.twitter_tweet' | t }}">{%- render 'icon', icon: 'twitter' -%}</a>
</li>

<li class="social-media__item">
<a href="mailto:?&subject={{ product.title | escape }}&body={{ share_url }}" aria-label="{{ 'general.social.email_share' | t }}">{% render 'icon', icon: 'email' %}</a>
</li>
</ul>
{%- endcapture -%}
{%- endif -%}

<div class="product-meta">
{%- if template.name == 'product' and template != 'product.quick-view' -%}
<h1 class="product-meta__title heading h1">{{ product.title }}</h1>
{%- else -%}
<h3 class="product-meta__title heading h2">
<a href="{{ product.url }}">{{ product.title }}</a>
</h3>
{%- endif -%}

{%- capture product_labels -%}
{%- for tag in product.tags -%}
{%- if tag contains '__label:' -%}
<span class="product-label product-label--custom1">{{ tag | split: '__label:' | last }}</span>
{%- endif -%}

{%- if tag contains '__label1:' -%}
<span class="product-label product-label--custom1">{{ tag | split: '__label1:' | last }}</span>
{%- endif -%}

{%- if tag contains '__label2:' -%}
<span class="product-label product-label--custom2">{{ tag | split: '__label2:' | last }}</span>
{%- endif -%}
{%- endfor -%}

{%- if settings.show_discount -%}
{%- assign savings = 0 -%}

{%- if settings.discount_mode == 'percentage' -%}
{%- assign savings = selected_variant.compare_at_price | minus: selected_variant.price | times: 100.0 | divided_by: selected_variant.compare_at_price | round | append: '%' -%}
{%- else -%}
{%- capture savings -%}<span>{{ selected_variant.compare_at_price | minus: selected_variant.price | money_without_trailing_zeros }}</span>{%- endcapture -%}
{%- endif -%}

<span class="product-label product-label--on-sale" {% unless selected_variant.price < selected_variant.compare_at_price %}style="display: none"{% endunless %}>{{ 'collection.product.discount_html' | t: savings: savings }}</span>
{%- endif -%}
{%- endcapture -%}

{%- if product_labels != blank -%}
<div class="product-meta__label-list">
{{- product_labels -}}
</div>
{%- endif -%}

{%- if section.settings.show_vendor or section.settings.show_sku and selected_variant.sku != blank -%}
<div class="product-meta__reference">
{%- if section.settings.show_vendor -%}
{%- assign vendor_handle = product.vendor | handle -%}
{%- assign collection_for_vendor = collections[vendor_handle] -%}

{%- unless collection_for_vendor.empty? -%}
<a class="product-meta__vendor link link--accented" href="{{ collection_for_vendor.url }}">{{ product.vendor }}</a>
{%- else -%}
<a class="product-meta__vendor link link--accented" href="{{ product.vendor | url_for_vendor }}">{{ product.vendor }}</a>
{%- endunless -%}
{%- endif -%}

{%- if section.settings.show_sku and selected_variant.sku != blank -%}
<span class="product-meta__sku">
{{- 'product.general.sku' | t -}} <span class="product-meta__sku-number">{{ selected_variant.sku }}</span>
</span>
{%- endif -%}
</div>
{%- endif -%}

{%- if section.settings.show_reviews_badge -%}
<a href="{% if template.name != 'product' or template == 'product.quick-view' %}{{ product.url | within: collection }}{% endif %}#product-reviews" class="product-meta__reviews-badge link" data-offset="30">
<span class="shopify-product-reviews-badge" data-id="{{ product.id }}">
{%- comment -%}Display a placeholder, to allocate space{%- endcomment -%}
<div class="spr-badge" style="opacity: 0">
<span class="spr-starrating spr-badge-starrating">
<i class="spr-icon spr-icon-star-empty"></i>
<i class="spr-icon spr-icon-star-empty"></i>
<i class="spr-icon spr-icon-star-empty"></i>
<i class="spr-icon spr-icon-star-empty"></i>
<i class="spr-icon spr-icon-star-empty"></i>
</span>

</div>
</span>
</a>
{%- endif -%}
{%- if section.settings.show_share_buttons -%}
<div class="product-meta__share-buttons hidden-phone">
{{ share_buttons }}
</div>
{%- endif -%}
</div>

<hr class="card__separator">

{%- if request.page_type == 'index' and section.settings.show_description and product.description != blank and section.settings.description_below_add_to_cart == false -%}
<div class="product-meta__description rte">
{{ product.description | remove: 'data-section-type="product"' }}
</div>
</div>
{%- endif -%}

<div id="delivery_timer_wrapper"></div>

{% comment %}
------------------------------------------------------------------------------
PRODUCT FORM
------------------------------------------------------------------------------
{% endcomment %}

<div class="product-meta">

<span class="Email signup">
{% for tag in product.tags %}
{% if tag contains 'COMING SOON' %}
{% form 'customer' %}
<input id="contact_tags" name="contact[tags]" type="hidden" value="RETAIL" />
<font size="+3">THIS PRODUCT IS COMING SOON.</font><b></b>
</br>
Sign up for our mailing list to be the first to know when it is released.
</br>We don't spam. We promise.</br></br>
<font color="grey"><input type="text" name="contact[first_name]" placeholder="First Name">
<input type="text" name="contact[last_name]" placeholder="Last Name">
</br>
<input id="contact_email" name="contact[email]" type="text" placeholder="Email address"/></font>
<button><type="submit"/><img src="https://i.imgur.com/iFXY9rN.jpg"</button>
{% endform %}
{% endif %}
{%- endfor -%}
</span>
</div>


{%- assign color_label = 'color,colour,couleur,cor,colore,farbe,색,色,カラー,färg,farve' | split: ',' -%}

{%- form 'product', product, class: 'product-form' -%}
{%- unless product.has_only_default_variant -%}

<div class="product-form__variants">
{%- for option in product.options_with_values -%}
{%- assign downcase_option = option.name | downcase -%}
{%- capture option_name -%}{{ section.id }}-{{ product.id }}-{{ forloop.index }}{%- endcapture -%}

{%- assign option_selector_type = 'select' -%}

{%- if section.settings.color_mode != 'block' and section.settings.color_mode != 'dropdown' and color_label contains downcase_option -%}
{%- comment -%}NOTE: even if the merchant is using the mode to display variant images, if ALL variant do not have an associated image, we fallback to color{%- endcomment -%}

{%- assign has_image_attached_to_all_variants = true -%}

{%- for variant in product.variants -%}
{%- unless variant.image -%}
{%- assign has_image_attached_to_all_variants = false -%}
{%- break -%}
{%- endunless -%}
{%- endfor -%}

{%- if section.settings.color_mode == 'color' or has_image_attached_to_all_variants == false -%}
{%- assign option_selector_type = 'color' -%}
{%- else -%}
{%- assign option_selector_type = 'variant' -%}
{%- endif -%}
{%- else -%}
{%- if color_label contains downcase_option -%}
{%- if section.settings.color_mode == 'block' -%}
{%- assign option_selector_type = 'block' -%}
{%- endif -%}
{%- elsif section.settings.selector_mode == 'block' -%}
{%- assign option_selector_type = 'block' -%}
{%- endif -%}
{%- endif -%}

<div class="product-form__option" data-selector-type="{{ option_selector_type }}">
{%- case option_selector_type -%}
{%- when 'color' -%}
<span class="product-form__option-name text--strong">{{ option.name }}: <span class="product-form__selected-value">{{ option.selected_value }}</span></span>

<div class="color-swatch-list color-swatch-list--large">
{%- for value in option.values -%}
{%- assign downcased_value = value | downcase -%}
{%- capture color_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

{%- assign color_swatch_name = value | handle | append: '.png' -%}
{%- assign color_swatch_image = images[color_swatch_name] -%}

<div class="color-swatch {% if downcased_value == 'white' or downcased_value == 'blanc' %}color-swatch--white{% endif %}">
<input class="color-swatch__radio product-form__single-selector" type="radio" name="{{ option_name }}" id="{{ color_id }}" value="{{ value | escape }}" {% if option.selected_value == value %}checked{% endif %} data-option-position="{{ option.position }}" aria-hidden="true">
<label class="color-swatch__item lazyload" for="{{ color_id }}" {% if color_swatch_image != blank %}data-bg="{{ color_swatch_image | img_url: '64x64' }}"{% else %}style="background-color: {{ value | replace: ' ', '' | downcase }}"{% endif %} title="{{ value | escape }}">{% render 'icon', icon: 'cross-sold-out' %}</label>
</div>
{%- endfor -%}
</div>
{%- when 'variant' -%}
<span class="product-form__option-name text--strong">{{ option.name }}: <span class="product-form__selected-value">{{ option.selected_value }}</span></span>

<div class="variant-swatch-list">
{%- capture option_name -%}option{{ option.position }}{%- endcapture -%}

{%- for value in option.values -%}
{%- capture variant_swatch_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

{%- for variant in product.variants -%}
{%- if variant[option_name] == value and variant.image -%}
<div class="variant-swatch">
<input class="variant-swatch__radio product-form__single-selector" type="radio" name="{{ option_name }}" id="{{ variant_swatch_id }}" value="{{ value | escape }}" {% if option.selected_value == value %}checked{% endif %} data-option-position="{{ option.position }}">

<label class="variant-swatch__item" for="{{ variant_swatch_id }}" title="{{ value | escape }}">
<div class="aspect-ratio" style="padding-bottom: {{ 100.0 | divided_by: variant.image.aspect_ratio }}%">
<img src="{{ variant.image | img_url: '120x' }}" alt="{{ variant.image.alt | escape }}">
</div>

{% render 'icon', icon: 'cross-sold-out' %}
</label>
</div>

{%- break -%}
{%- endif -%}
{%- endfor -%}
{%- endfor -%}
</div>
{%- when 'block' -%}
<span class="product-form__option-name text--strong">{{ option.name }}: <span class="product-form__selected-value">{{ option.selected_value }}</span></span>

<div class="block-swatch-list">
{%- for value in option.values -%}
{%- capture block_swatch_id -%}{{ option_name }}-{{ forloop.index }}{%- endcapture -%}

<div class="block-swatch">
<input class="block-swatch__radio product-form__single-selector" type="radio" name="{{ option_name }}" id="{{ block_swatch_id }}" value="{{ value | escape }}" {% if option.selected_value == value %}checked{% endif %} data-option-position="{{ option.position }}" aria-hidden="true">
<label class="block-swatch__item" for="{{ block_swatch_id }}" title="{{ value | escape }}">
<span class="block-swatch__item-text">{{ value }}</span>
</label>
</div>
{%- endfor -%}
</div>
{%- when 'select' -%}
<label for="{{ option_name }}" class="product-form__option-name text--strong">{{ option.name }}: <span class="product-form__selected-value">{{ option.selected_value }}</span></label>

<div class="select-wrapper select-wrapper--primary">
{%- render 'icon', icon: 'arrow-bottom' -%}

<select class="product-form__single-selector" name="{{ option_name }}" id="{{ option_name }}" data-option-position="{{ option.position }}">
{%- for value in option.values -%}
<option value="{{ value | escape }}" {% if value == option.selected_value %}selected="selected"{% endif %}>{{ value }}</option>
{%- endfor -%}
</select>
</div>
{%- endcase -%}
</div>
{%- endfor -%}

<div class="no-js product-form__option">
<label for="product-select-{{ product.id }}">{{ 'product.form.variant' | t }}</label>

<div class="select-wrapper select-wrapper--primary">
<select id="product-select-{{ product.id }}" name="id">
{%- for variant in product.variants -%}
<option {% if variant == selected_variant %}selected="selected"{% endif %} {% unless variant.available %}disabled="disabled"{% endunless %} value="{{ variant.id }}" data-sku="{{ variant.sku }}">{{ variant.title }} - {{ variant.price | times: 1.2 | money }}</option>
{%- endfor -%}
</select>
</div>
</div>
</div>
{%- else -%}
<input type="hidden" name="id" data-sku="{{ selected_variant.sku }}" value="{{ selected_variant.id }}">
{%- endunless -%}

 

<div class="product-form__info-list">
<div class="product-form__info-item">
<span class="product-form__info-title text--strong">{{ 'product.form.price' | t }}:</span>



<div class="product-form__info-content">
<div class="price-list">
{%- if selected_variant.compare_at_price > selected_variant.price -%}
<span class="price price--highlight">{{ selected_variant.price | times: 1.2 | money_without_trailing_zeros }}</span>
<span class="price price--compare">{{ selected_variant.compare_at_price | times: 1.2 | money_without_trailing_zeros }}</span>
{%- else -%}
<span class="price">{{ selected_variant.price | times: 1.2 | money_without_trailing_zeros }}</span>
{%- endif -%}
</div>

<div class="product-form__price-info" style="display: {% if selected_variant.unit_price_measurement %}block{% else %}none{% endif %}">
<div class="unit-price-measurement">
<span class="unit-price-measurement__price">{{ selected_variant.unit_price | times: 1.2 | money_without_trailing_zeros }}</span>
<span class="unit-price-measurement__separator">/ </span>

{%- if selected_variant.unit_price_measurement.reference_value != 1 -%}
<span class="unit-price-measurement__reference-value">{{ selected_variant.unit_price_measurement.reference_value }}</span>
{%- endif -%}

<span class="unit-price-measurement__reference-unit">{{ selected_variant.unit_price_measurement.reference_unit }}</span>
</div>
</div>

{%- if section.settings.show_taxes_included -%}
{%- if shop.taxes_included or shop.shipping_policy.body != blank -%}
<p class="product-form__price-info">
{%- if shop.taxes_included -%}
{{ 'product.general.include_taxes' | t }}
{%- endif -%}

{%- if shop.shipping_policy.body != blank -%}
{{ 'product.general.shipping_policy_html' | t: link: shop.shipping_policy.url }}
{%- endif -%}
</p>
{%- endif -%}
{%- endif -%}
</div>
</div>


{% comment %}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CODE REGARDING BULLET POINT SHOWS HERE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

{% endcomment %}


{% for tag in product.tags %}
{% if tag == '__label:PRE-ORDER' %}
<span class="product-item__inventory inventory inventory">PRE-ORDER</span>
{% else %}

{% if tag == 'InStock' -%}
<span class="product-item__inventory inventory inventory--high">AVAILABLE TO ORDER</span>
{% else %}

{% if tag == '__label1:COMING SOON' %}
<span class="product-item__inventory inventory inventory--low">COMING SOON</span>
{% else %}

{% if tag == 'LOWSTOCK' %}
<span class="product-form__inventory inventory inventory--low">LOW STOCK</span>
{% else %}

{% if tag == 'NIS' %}
<span class="product-item__inventory inventory">OUT OF STOCK</span>
{% else %}

{% if tag == '__label:DISCONTINUED' %}
<span class="product-item__inventory inventory">DISCONTINUED</span>
{% else %}

{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}

 


{% comment %}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CODE REGARDING BULLET POINT ENDS HERE
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

{% endcomment %}


{% for tag in product.tags %}
{% if tag contains 'InStock' %}

{%- if product.template_suffix != 'contact' -%}
{%- if section.settings.show_quantity_selector -%}
<div class="product-form__info-item product-form__info-item--quantity">
<label for="{{ section.id }}-{{ product.id }}-quantity" class="product-form__info-title text--strong">{{ 'product.form.quantity' | t }}:</label>



<div class="product-form__info-content">
<div class="select-wrapper select-wrapper--small select-wrapper--primary">
{%- render 'icon', icon: 'arrow-bottom' -%}

<select name="quantity" id="{{ section.id }}-{{ product.id }}-quantity" class="product-form__quantity">
{%- for i in (1..10) -%}
<option value="{{ i }}" {% if forloop.first %}selected="selected"{% endif %}>{% if i < 10 %}{{ i }}{% else %}{{ i }}+{% endif %}</option>
{%- endfor -%}
</select>
</div>
</div>
</div>
{%- else -%}
<input type="hidden" name="quantity" value="1">
{%- endif -%}
{%- endif -%}
{% endif %}
{%- endfor -%}

{% for tag in product.tags %}
{% if tag contains 'PRE-ORDER' %}

{%- if product.template_suffix != 'contact' -%}
{%- if section.settings.show_quantity_selector -%}
<div class="product-form__info-item product-form__info-item--quantity">
<label for="{{ section.id }}-{{ product.id }}-quantity" class="product-form__info-title text--strong">{{ 'product.form.quantity' | t }}:</label>



<div class="product-form__info-content">
<div class="select-wrapper select-wrapper--small select-wrapper--primary">
{%- render 'icon', icon: 'arrow-bottom' -%}

<select name="quantity" id="{{ section.id }}-{{ product.id }}-quantity" class="product-form__quantity">
{%- for i in (1..10) -%}
<option value="{{ i }}" {% if forloop.first %}selected="selected"{% endif %}>{% if i < 10 %}{{ i }}{% else %}{{ i }}+{% endif %}</option>
{%- endfor -%}
</select>
</div>
</div>
</div>
{%- else -%}
<input type="hidden" name="quantity" value="1">
{%- endif -%}
{%- endif -%}
{% endif %}
{%- endfor -%}

{% for tag in product.tags %}
{% if tag contains 'LOWSTOCK' %}

{%- if product.template_suffix != 'contact' -%}
{%- if section.settings.show_quantity_selector -%}
<div class="product-form__info-item product-form__info-item--quantity">
<label for="{{ section.id }}-{{ product.id }}-quantity" class="product-form__info-title text--strong">{{ 'product.form.quantity' | t }}:</label>



<div class="product-form__info-content">
<div class="select-wrapper select-wrapper--small select-wrapper--primary">
{%- render 'icon', icon: 'arrow-bottom' -%}

<select name="quantity" id="{{ section.id }}-{{ product.id }}-quantity" class="product-form__quantity">
{%- for i in (1..10) -%}
<option value="{{ i }}" {% if forloop.first %}selected="selected"{% endif %}>{% if i < 10 %}{{ i }}{% else %}{{ i }}+{% endif %}</option>
{%- endfor -%}
</select>
</div>
</div>
</div>
{%- else -%}
<input type="hidden" name="quantity" value="1">
{%- endif -%}
{%- endif -%}
{% endif %}
{%- endfor -%}

</div>

{%- if product.handle contains '50ml' %}
<font color="red"><b>PLEASE NOTE: WE DO NOT INCLUDE NIC SHOTS.</font></b>
</BR><font size="-1">FOR THIS LIQUID PLEASE PURCHASE 1X 18MG <U><A HREF="https://www.ukaspirevendor.co.uk/products/nic-nic-18mg-nic-shot"" target="_blank">NIC SHOT</A></U> TO MAKE 3MG.
{% elsif product.handle contains '80ml' %}
</br><font color="red"><b>PLEASE NOTE: WE DO NOT INCLUDE NIC SHOTS.</font></b>
</br><font size="-1">FOR THIS LIQUID PLEASE PURCHASE 2X 18MG + ADD 1.6 <U><A HREF="https://www.ukaspirevendor.co.uk/products/nic-nic-18mg-nic-shot"" target="_blank">NIC SHOTS</A></U> TO MAKE 3MG.
{% elsif product.handle contains '100ml' %}
</br><font color="red"><b>PLEASE NOTE: WE DO NOT INCLUDE NIC SHOTS.</font></b>
</BR><font size="-1">FOR THIS LIQUID PLEASE PURCHASE 2X 18MG <U><A HREF="https://www.ukaspirevendor.co.uk/products/nic-nic-18mg-nic-shot"" target="_blank">NIC SHOTS</A></U> TO MAKE 3MG.
{% elsif product.handle contains '200ml' %}
</br><font color="red"><b>PLEASE NOTE: WE DO NOT INCLUDE NIC SHOTS.</font></b>
</BR><font size="-1">FOR THIS LIQUID PLEASE PURCHASE 4X 18MG <U><A HREF="https://www.ukaspirevendor.co.uk/products/nic-nic-18mg-nic-shot"" target="_blank">NIC SHOTS</A></U> TO MAKE 3MG.
{% endif %}
</br></br>

{% for tag in product.tags %}
{% if tag contains 'InStock' %}
<div class="product-form__payment-container">
{%- if product.template_suffix != 'contact' -%}
{%- if selected_variant.available -%}
{% if tag contains 'PREORDER' %}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.pre_order' | t }}</button>
{%- else -%}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.add_to_cart' | t }}</button>
{%- endif -%}
{%- else -%}
<button type="submit" class="product-form__add-button button button--disabled" disabled>{{ 'product.form.sold_out' | t }}</button>
{%- endif -%}

{%- if section.settings.show_payment_button -%}
{{ form | payment_button }}
{%- endif -%}
{%- else -%}
<a href="mailto:{{ shop.email }}" class="button button--primary">{{ 'product.form.contact_us' | t }}</a>
{%- endif -%}
</div>
{% endif %}
{%- endfor -%}

{% for tag in product.tags %}
{% if tag contains 'LOWSTOCK' %}
<div class="product-form__payment-container">
{%- if product.template_suffix != 'contact' -%}
{%- if selected_variant.available -%}
{% if tag contains 'PREORDER' %}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.pre_order' | t }}</button>
{%- else -%}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.add_to_cart' | t }}</button>
{%- endif -%}
{%- else -%}
<button type="submit" class="product-form__add-button button button--disabled" disabled>{{ 'product.form.sold_out' | t }}</button>
{%- endif -%}

{%- if section.settings.show_payment_button -%}
{{ form | payment_button }}
{%- endif -%}
{%- else -%}
<a href="mailto:{{ shop.email }}" class="button button--primary">{{ 'product.form.contact_us' | t }}</a>
{%- endif -%}
</div>
{% endif %}
{%- endfor -%}

{% for tag in product.tags %}
{% if tag contains 'PRE-ORDER' %}
<div class="product-form__payment-container">
{%- if product.template_suffix != 'contact' -%}
{%- if selected_variant.available -%}
{% if tag contains 'PREORDER' %}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.pre_order' | t }}</button>
{%- else -%}
<button type="submit" class="product-form__add-button button button--primary" data-action="add-to-cart">{{ 'product.form.add_to_cart' | t }}</button>
{%- endif -%}
{%- else -%}
<button type="submit" class="product-form__add-button button button--disabled" disabled>{{ 'product.form.sold_out' | t }}</button>
{%- endif -%}

{%- if section.settings.show_payment_button -%}
{{ form | payment_button }}
{%- endif -%}
{%- else -%}
<a href="mailto:{{ shop.email }}" class="button button--primary">{{ 'product.form.contact_us' | t }}</a>
{%- endif -%}
</div>
{% endif %}
{%- endfor -%}
{%- endform -%}


</div>

{%- if request.page_type == 'index' and section.settings.show_description and product.description != blank and section.settings.description_below_add_to_cart -%}
<div class="product-meta__description rte">
{{ product.description }}
</div>
{%- endif -%}

{%- if section.settings.show_share_buttons -%}
<div class="product-meta__share-buttons hidden-tablet-and-up">
<span class="text--strong">{{ 'product.general.share' | t }}</span>
{{ share_buttons }}
</div>
{%- endif -%}

</div>

{%- if section.settings.show_payment_button and product.selected_or_first_available_variant.available == false -%}
<style>
#shopify-section-{{ section.id }} .shopify-payment-button {
display: none;
}



</style>


{%- endif -%}

{% comment %}
------------------------------------------------------------------------------
Product Data. This must be outputted for all products (including home page).

IMPORTANT: THIS CODE IS VITAL. DO NOT EDIT IT NOT REMOVE IT. MAKE SURE TO KEEP
THE EXACT SAME ATTRIBUTES.
------------------------------------------------------------------------------
{% endcomment %}


{% comment %}

-------------------------------------------------------------------------------------------------------
DAVE NOTES - I'M HIDING THIS SECTION BECAUSE IF A VARIANT IS SELECTED THE INVENTORY NUMBERS WILL RETURN
-------------------------------------------------------------------------------------------------------
<script type="application/json" data-product-json>
{
"product": {{ product | json }},
"options_with_values": {{ product.options_with_values | json }},
"selected_variant_id": {{ selected_variant.id }}
{%- if section.settings.show_inventory_quantity -%}
,"inventories": {
{%- for variant in product.variants -%}
{%- if variant.available -%}
{%- if variant.inventory_management and variant.inventory_policy == 'deny' and section.settings.low_inventory_threshold > 0 -%}
{%- if variant.inventory_quantity <= section.settings.low_inventory_threshold -%}
{%- capture inventory_message -%}{{ 'product.form.low_stock_with_quantity_count' | t: count: variant.inventory_quantity }}{%- endcapture -%}
{%- else -%}
{%- capture inventory_message -%}{{ 'product.form.in_stock_with_quantity_count' | t: count: variant.inventory_quantity }}{%- endcapture -%}
{%- endif -%}
{%- else -%}
{%- capture inventory_message -%}{{ 'product.form.in_stock' | t }}{%- endcapture -%}
{%- endif -%}
{%- else -%}
{%- capture inventory_message -%}{{ 'product.form.sold_out' | t }}{%- endcapture -%}
{%- endif -%}

"{{ variant.id }}": {
"inventory_management": {{ variant.inventory_management | json }},
"inventory_policy": {{ variant.inventory_policy | json }},
"inventory_quantity": {{ variant.inventory_quantity | json }},
"inventory_message": {{ inventory_message | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}
}
{%- endif -%}
}
</script>
-------------------------------------------------------------------------------------------------------
END HIDDEN CODE HERE
-------------------------------------------------------------------------------------------------------
{% endcomment %}

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1066 64 124

Hi there @UK_Aspire_Vendo!

Don here from Shopify.

Thanks for the info and store link here.

In order to get this investigated further, I'll just need to send an email out to the address we have on file for you here so we can escalate this securely.

I'll be sending that out shortly, so if you can just reply there we can use this to verify your identity and proceed to work on this securely.

All the best!

 

Regards,

Don

Don | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes