Variant price difference not being rendered dynamicaly

Variant price difference not being rendered dynamicaly

Bill53
Visitor
2 0 0

Hello, so I have a product with variant sizes, i have a variant price and a compare at price. They both seem to work, i added with code the price difference between those 2 and it also works but when I change size variants the price difference is not changing but the other 2 change correctly. If I refresh the product at the current variant it correctly displays it but if I change size again it keeps the previous rendered price difference. This is the code for the price difference 
{% if variant.compare_at_price > 0 %}
{% assign price_difference = variant.compare_at_price | minus: variant.price %}
<span class="price-difference"><p> κερδίζετε {{ price_difference | money }}</p></span>
<style>
sale-price {
white-space: break-spaces !important;
}
</style>
{%- endif -%}
I've also tried to put it out of <p> and then out of <span> but it didn't change much. I've also tried to refresh the span with JavaScript whenever there was a change in the URL (when I click other sizes) and I also tried calling it with "render" and "capture". Any ideas? Thank you in advance.

Reply 1 (1)

laddisahsi
Shopify Partner
385 38 41

Hi @Bill53 

How are you?

for this have to add JS code according to theme to update the price acccording variant on change,

It will took 2-3 Hours approx.

Please let me know if need any help from my end.

Contact info in signature.

Thanks
Laddi

-Shopify website development, Theme & App Development
-Contact me: WhatsApp


-Email Me
-If this solution is worked, then please Like this and Mark this as accepted solution!