Cart displays wrong variant Debut Theme

Susher
New Member
3 0 0

Hello, I hope someone cam help. Im using the Debut theme and recently I discovered that only the first variant is being displayed in the cart. I'm pretty sure my java script got messed up sometime yesterday when i was adding the on site messaging for the klarna app. If someone could please help me I would be extremely grateful.

this is the script thats on the product page:

{% comment %}
The contents of the product.liquid template can be found in /sections/product-template.liquid
{% endcomment %}

{% section 'product-template' %}
{% section 'product-recommendations' %}

{% if collection %}
<div class="text-center return-link-wrapper page-width">
<a href="{{ collection.url }}" class="btn btn--secondary btn--has-icon-before return-link">
{% include 'icon-arrow-left' %}
{{ 'products.product.back_to_collection' | t: title: collection.title }}
</a>
</div>
{% endif %}

<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>

{% assign current_variant = product.selected_or_first_available_variant %}

<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": {{ product.title | json }},
"url": {{ shop.url | append: product.url | json }},
{%- if product.featured_media -%}
{%- assign media_size = product.featured_media.preview_image.width | append: 'x' -%}
"image": [
{{ product.featured_media | img_url: media_size | prepend: "https:" | json }}
],
{%- endif -%}
"description": {{ product.description | strip_html | json }},
{%- if current_variant.sku != blank -%}
"sku": {{ current_variant.sku | json }},
{%- endif -%}
"brand": {
"@type": "Thing",
"name": {{ product.vendor | json }}
},
"offers": [
{%- for variant in product.variants -%}
{
"@type" : "Offer",
{%- if variant.sku != blank -%}
"sku": {{ variant.sku | json }},
{%- endif -%}
"availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"price" : {{ variant.price | divided_by: 100.00 | json }},
"priceCurrency" : {{ cart.currency.iso_code | json }},
"url" : {{ shop.url | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}

 

Thanks

Steph

0 Likes
KristiAtKlarna
Shopify Partner
99 6 20

Hi @Susher,

We're very sorry that Klarna's On-site messaging might have caused any issues for you.  (We have a free app so that you can add Klarna's On-site messaging to your store without having to edit any theme code hopefully, and app support is available at skosm@klarna.com)

To check your Debut theme code, you could add the free Debut theme to your store and compare your file to the published version of the theme files, e.g. with a difference checker.  

Based on my diff checking, there is a bit more code at the end of the Debut templates/product.liquid file not included in your post above.  Hope this helps!

 

 

]
}
</script>

 

0 Likes