You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shopify选项选择器无法更新价格问题求助

Troubleshooting Price Update Issue After Bold Plugin Conflict

Hey there, let's walk through how to track down why your product options are displaying correctly but the price isn't updating when selections change—especially since this started after installing the Bold plugin.

First, Check for Console Errors

Start by opening your browser's DevTools (F12) and switching to the Console tab. Refresh the product page and play around with the option selectors. Look for any JavaScript errors related to Bold (e.g., BoldProductOptions undefined) or Shopify's native product form logic. Even a small error can break the entire price update chain.

Verify Variant Data is Being Retrieved Correctly

When an option changes, your code needs to fetch the corresponding product variant (which includes the correct price). Let's test this with a quick snippet you can run directly in the Console:

// Target your option selector (adjust the selector if your form uses different classes)
const optionSelect = document.querySelector('.product-form__input select');
optionSelect.addEventListener('change', () => {
  // Check if Shopify's native variant logic is working
  if (window.Shopify?.ProductForm) {
    const currentVariant = Shopify.ProductForm.getCurrentVariant();
    console.log('Native Shopify Variant:', currentVariant);
  }
  // Check if Bold's variant tracking is active
  if (window.BoldProductOptions) {
    console.log('Bold Selected Variant:', BoldProductOptions.selectedVariant);
  }
});

If either currentVariant or selectedVariant returns null or doesn't show the correct price, that's a clear sign your option changes aren't mapping to the right variant data.

Inspect Event Listeners on Option Selectors

Bold often overrides native Shopify event listeners for option changes. Go to the Elements tab in DevTools, select one of your option dropdowns, then check the Event Listeners panel (under the "Listeners" tab). Look for:

  • Conflicting change events (both native Shopify and Bold might be trying to handle the same event)
  • Events that use stopPropagation() or preventDefault(), which could block the price update trigger from firing

Check Price Update Logic in product-form.liquid

Open your product-form.liquid snippet and look for code that handles price updates. Common scenarios to verify:

  • If you restored native Shopify logic, make sure the variant:change event is being listened to, and that it's updating the price element correctly. For example:
    document.addEventListener('variant:change', (event) => {
      const variant = event.detail.variant;
      if (variant) {
        document.querySelector('.product-price').textContent = Shopify.formatMoney(variant.price);
      }
    });
    
  • If Bold's logic is still supposed to handle pricing, ensure that BoldProductOptions.init() or similar initialization code runs after your form loads, and that it targets the correct price element in your template.

Confirm Price Element Targeting in product.template

In your product.template file, check the price display element (e.g., <span class="product-price">...</span>). Bold often requires specific class names or IDs to hook into for price updates. If you modified the element's classes when restoring the option selector, Bold's code might no longer find it to update the price. Look for comments or references to Bold in the template that indicate the expected selector.

Test Disabling Bold Temporarily (Safely)

As a quick sanity check, you can temporarily disable the Bold plugin in your Shopify admin and see if the price updates work with your restored option selector. If it does, the issue is definitely a misalignment between your custom form logic and Bold's pricing hooks.


内容的提问来源于stack exchange,提问作者Dustin Lee

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:59:38