The price of any variant product doesn't change when a different varation is chosen

Solved
Tourist
9 1 0

Hi,

 

I am having a problem on my site that I am hoping that someone will shed some light. The price of any variant product doesn't change when a different varation is chosen unless I refresh the page after chosing a variant. If added to the cart, the cart gets the correct price but that is not the case on the product page. 

 

Any help?

 

This is a snippet of my product.luquid:

 

<span class="special-price product-price__price product-price__price-{{ section.id }} product-price__sale product-price__sale--single">
<span id="ProductPrice-{{ section.id }}"
itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
{{ current_variant.price | money }}
</span>
</span>
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s class="old-price" id="ComparePrice-{{ section.id }}">{{ current_variant.compare_at_price | money }}</s>
{% else %}
<span class="visually-hidden">{{ 'products.product.regular_price' | t }}</span>
<s id="ComparePrice-{{ section.id }}" class="hide">{{ current_variant.compare_at_price | money }}</s>
<span class="product-price__price product-price__price-{{ section.id }} price">
<span id="ProductPrice-{{ section.id }}" itemprop="price" content="{{ current_variant.price | divided_by: 100.00 }}">
{{ current_variant.price | money }}
</span>
<span class="product-price__sale-label product-price__sale-label-{{ section.id }} hide">{{ 'products.product.on_sale' | t }}</span>
</span>
{% endif %}

0 Likes
Shopify Expert
2521 423 533

Hi @appleyard 

If price not changing on variants selection then you have problem with you sellectCallback function.

Check in Asset->theme.js->find "if(variants)" condition from where your Js call on variants changes or send me store url. 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
9 1 0

Hi Jasoliya, here is alink to a variable product: https://bit.ly/2lshh9J

 

Choosing 15ml or 30ml is supposed to change the price.

0 Likes
Tourist
9 1 0

Anyone? 

0 Likes
Shopify Expert
2521 423 533

Cant debug from just console need to check in code. follow step that i sent you because may be its Js issue.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes

Success.

Shopify Expert
2684 67 676

You have your selectCallBack function in your product-template.liquid section. However, it uses wrong selectors to  update price(s) -- probably your template was changed and javascript code not updated to reflect this.

Here is a piece of code from the function (as I see it on the front-end):

 

  var selectCallback = function(variant, selector) {
    var addToCart = jQuery('#AddToCart-product-template'),
        productPrice = jQuery('.product .product-price__price span.money'),
        comparePrice = jQuery('.product .compare-price');

Try changing it as follows:

 

 

  var selectCallback = function(variant, selector) {
    var addToCart = jQuery('#AddToCart-product-template'),
        productPrice = jQuery('#ProductPrice-{{ section.id }}'),
        comparePrice = jQuery('#ComparePrice-{{ section.id }}');

Do not forget to make a backup theme copy via Actions=>Duplicate before doing edits.

 

Want to hire me to tweak a theme? Mail me at tairli@yahoo.com!
My post solved your problem? Like it!
2 Likes
Tourist
9 1 0

Thanks! I have read all of the topics for the same issue and it always seems to be something different in the theme. Tim is usually the one solving this threads :) 

0 Likes