如何 Shopify 显示产品变体的不含增值税价格?

问题描述 投票:0回答:1

一直在开发一个网站,我希望在产品页面上显示两个价格。

  1. 默认公司增值税价格
  2. 不含增值税价格,即默认价格除以 1.2

我们正在使用企业主题,我通过修改 main-product.liquid 文件设法让它显示在产品页面上。

          {%- when 'price' -%}
            <div class="product-info__block product-info__block--sm product-price" {{ block.shopify_attributes }}>
              <div class="product-info__price">
                {% render 'price', product: product, use_variant: true %}
                <p> {{ product.price | divided_by: 1.2 | money }} ex. VAT </p>
              </div>

但是,我现在遇到的问题是,当点击产品的不同变体时,价格不会更新,默认价格会更新,只是不是我添加的增值税价格。

有什么指点吗?谢谢。

javascript shopify liquid shopify-template liquid-template
1个回答
0
投票

您可以编辑

price.liquid
文件。

你的计算

assign tax_price = target.price | divided_by: 1.2
assign tax_money_price = tax_price | money

[price calculation]

您的标记

<div class="price__regular tax__price">
  <span class="tax-included-price price-item price-item--regular">
    {{ tax_money_price }} excluding VAT.
  </span>
</div>

结果

如有疑问请评论

© www.soinside.com 2019 - 2024. All rights reserved.