Update Pricing Details on variant selection

Hi Everyone.

Im hoping someone could assist me with a solution to this problem.

Store: https://aboschuh.ch/products/abonnieren

Problem:

We have 2 variant options for this product which are required to display the 2 different pricing structures based on which variant is selected.

Variant 1: Mieten: CHF 12.90

&

Variant 2: Kaufen: CHF 229.00

I am hoping to update the Pricing and display on the page as follows:

Mieten: CHF 12.90 /Monat Regulärer PreisCHF 229.00
&
Kaufen: CHF 229.00

However I am facing what seems like a common problem on Shopify, my pricing field does not seem to update fully based on the variant selection. I have tried using various solutions but have not been able to fix this.

The code I have used is located in the product.blocks.liquid

Code:
{%- when ‘price’ -%}

{% if current_variant.price <= 1290 %} Mieten: {{ current_variant.price | money_with_currency }} /Monat {% endif %} {% if current_variant.price => 1290 %} Kaufen: {{ current_variant.price | money }} {% endif %}

It renders part of what i am needing but unfortunately a hard refresh is required to change the full extent of the pricing field.

Could someone kindly assist me with this and how to implement correctly.

Thanks in advance

Thor

Hello @Thor_SA ,

I don’t think it’s a problem with Shopify. It’s the default behaviour of the theme code you are using.
And to achieve the requirement you shared you have to make the modification in the theme JS file.
Check from where the price changes through JS and then implement your logic accordingly.

Thanks @Guleria I will have a look at the theme.js file and try implement.

If you could point me in the right direction in terms of syntax/snippet that would be greatly appreciated.

Thanks

Thor