Price doesn't change with product variants

Hello everyone,

I’m trying to set up some products pages that contain variants with different prices (sizes). However when changing the variant in the product page of the shop, the price shown seems to stick to the first variant… and even if you try to add the second variant to the cart, the cart fills with the first variant.

Any help would be greatly appreciated!

Below the code of the “product price liquid”


{% if product.title %}
{%- assign compare_at_price = product.compare_at_price -%}
{%- assign price = product.price -%}
{%- assign price_varies = product.price_varies -%}
{%- assign available = product.available -%}
{% else %}
{%- assign compare_at_price = 1999 -%}
{%- assign price = 1999 -%}
{%- assign price_varies = false -%}
{%- assign available = true -%}
{% endif %}

{%- assign money_price = price | money -%}

{% if compare_at_price > price %}
{% if price_varies %}
{{ 'products.product.regular_price' | t }}
{{ money_price }}
{{ compare_at_price | money }} 
{% else %}
{{ 'products.product.regular_price' | t }}
{{ money_price }}
 {{ compare_at_price | money }} 
{% endif %}
{% else %}

{% if price_varies %}
{{ money_price }}
{% else %}
{{ 'products.product.regular_price' | t }}
{{ money_price }}
{% endif %}
{% endif %}

Thank you !

Hello @SISAL ,

This issue belongs to JS and we call it JS conflict. To confirm open your store in chrome → right click anywhere in page → click on Inspect → Click on console.
Here you can find the errors now get back to the code and fix the issues.

Thanks