Why does mobile view display the wrong product variant in my cart?

Hello,

Overview:

In mobile view, when adding Product one to the cart, it shows product two instead. This only happens in mobile view.

I noticed in the code, It shows the incorrect variant ID in mobile view and the correct in Desktop view. There are two in the code below


PRODUCT FORMS
{%- endcomment -%}

{% if forloop.first %}

{% for block in blocks %}

{% assign _data = block.settings %}
{% assign _product = all_products[_data.product] %}
{% assign _variant = _product.selected_or_first_available_variant %}

{{ _product.price | money }}

{{ _variant.options[0] }} {{ _data.price_per_can }}

{{ section.settings.preorder_note }}

{% render 'svg--minus' %}


<button
type=“button”
class=“p-[14px]”
@Click =“quantity++”

{% render 'svg--plus' %}

<button
class=“btn block w-full group relative”
type=“submit”
@Click .prevent=“$store.cart.add([{ id: {{ _variant.id }}, quantity } ])”

Add to cart {% render 'svg--atc' %}

{% endfor %}

{% else %}

Pre Order

{{ product.price | money }}

{{ variant.options[0] }} {{ data.price_per_can }}

{{ section.settings.preorder_note }}

{% render 'svg--minus' %}


<button
type=“button”
class=“p-[14px]”
@Click =“quantity++”

{% render 'svg--plus' %}

{{ product.price | money }}

<button
class=“btn block w-full group relative”
type=“submit”
@Click .prevent=“$store.cart.add([{ id: {{ _variant.id }}, quantity } ])”

Add to cart {% render 'svg--atc' %}

{% endif %}


Your help is appreciated.

Best,

Randy

Hi @Randyg ,

Please send your site and if your site is password protected, please send me the password.

I will check it for you.

1 Like

Hi LitExtention,

Please see the link below. Happens only for the strawberry in mobile view. Add a strawberry to the cart and it will be pineapple instead.

https://www.drinksool.com/

Thank you,

Randy