Update Pricing Details on variant selection

Update Pricing Details on variant selection

Thor_SA
Shopify Partner
13 1 3

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' -%}
<div class="product__price fs-body-base">
{% if current_variant.price <= 1290 %}
Mieten:<span data-price> {{ current_variant.price | money_with_currency }}
</span>/Monat
{% endif %}
{% if current_variant.price => 1290 %}
Kaufen:<span data-price> {{ current_variant.price | money }}</span>
{% endif %}
</div>
 

 

 

 

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

 
Replies 2 (2)

Guleria
Shopify Partner
4188 812 1168

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.

 

- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
Thor_SA
Shopify Partner
13 1 3

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