【发布时间】:2021-06-02 08:56:03
【问题描述】:
我正在使用 Shopify Debut 主题,我想以某种方式在变体价格中添加增值税 (7%)。
静态价格我可以开始工作,但是当更改具有不同价格的变体时,hQuery 会覆盖这个,我不知道如何通过 jQuery 来改变它。
这是来自 theme.js 的 jQuery sn-p
/**
* Trigger event when variant price changes.
*
* @param {object} variant - Currently selected variant
* @return {event} variantPriceChange
*/
_updatePrice: function(variant) {
if (
variant.price === this.currentVariant.price &&
variant.compare_at_price === this.currentVariant.compare_at_price
) {
return;
}
this.$container.trigger({
type: 'variantPriceChange',
variant: variant
});
},
对于主题模板中的单一价格更改,我使用这个 sn-p,它可以工作,但不适用于 jQuery。
{{ compare_at_price | times:1.07 | money }}
theme.js的完整源文件
【问题讨论】:
标签: jquery shopify shopify-template