We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Variant picker on collection page not updating price - Tinker

Solved

Variant picker on collection page not updating price - Tinker

HBaars
Tourist
5 0 1

Having issues with the Variant Picker on collection pages not loading the corresponding variant price, or eventually loading once clicking back and forth on different variants a few times. 

 

Seems to be working correctly on the product page. Using Tinker theme.

Accepted Solution (1)

jakeclifford
Shopify Partner
93 18 25

This is an accepted solution.

Hi @HBaars,

What version of the Tinker theme are you using?

It does this automatically on version 1.0.5 without code changes so you may need to update. 

 

Hope that helps,
Jake 

I'm Jake the Shopify Wizard! If helpful Like and Mark as an Accepted Solution
My Blog - Tips and Tricks for Shopify Horizon and AI features Horizon + AI

Struggling to solve an annoying issue? Get Help Fast

View solution in original post

Replies 3 (3)

rajweb
Shopify Partner
845 71 161

Hey @HBaars 

The issue with the variant price not updating on the collection page is due to missing product data and JS logic. I’ve prepared a quick fix using product JSON and a script to update the price when a variant is selected.

<div class="product-card" data-product='{{ product | json | escape }}'>
  <select class="variant-picker">
    {% for variant in product.variants %}
      <option value="{{ variant.id }}">{{ variant.title }}</option>
    {% endfor %}
  </select>

  <div class="price">
    {{ product.price | money }}
  </div>
</div>

JavaScript Code (add to your theme's main JS file):

document.addEventListener('DOMContentLoaded', function () {
  document.querySelectorAll('.product-card').forEach(card => {
    const productData = JSON.parse(card.dataset.product);
    const variantSelector = card.querySelector('.variant-picker');
    const priceContainer = card.querySelector('.price');

    if (variantSelector && priceContainer) {
      variantSelector.addEventListener('change', (e) => {
        const selectedId = e.target.value;
        const selectedVariant = productData.variants.find(v => v.id == selectedId);

        if (selectedVariant) {
          priceContainer.innerHTML = Shopify.formatMoney(
            selectedVariant.price,
            "{{ shop.money_format }}"
          );
        }
      });
    }
  });
});

Let me know if you'd like me to implement this directly for you — please feel free to reach out!

Best Regards,

Rajat 

[ Shopify Expert ]

Rajat | Shopify Expert Developer
Need a reliable developer for your next Shopify project? Let's connect!
Email: rajat.shopify@gmail.com
Portfolio: rajatweb.dev
Your one-stop partner for Shopify development, SEO, and performance. Let’s grow your store together!

jakeclifford
Shopify Partner
93 18 25

This is an accepted solution.

Hi @HBaars,

What version of the Tinker theme are you using?

It does this automatically on version 1.0.5 without code changes so you may need to update. 

 

Hope that helps,
Jake 

I'm Jake the Shopify Wizard! If helpful Like and Mark as an Accepted Solution
My Blog - Tips and Tricks for Shopify Horizon and AI features Horizon + AI

Struggling to solve an annoying issue? Get Help Fast

HBaars
Tourist
5 0 1

Ended up moving from Tinker 1.0.2 to 1.0.5 to resolve this issue.