【发布时间】:2019-07-22 18:35:39
【问题描述】:
我的产品的折扣百分比始终等于 0%
我上传的新商店主题出现此问题
请检查连接的图像: https://image.noelshack.com/fichiers/2019/30/1/1563820267-capture.png)
我尝试检查 product-template.liquid 文件中的代码,但没有发现任何错误。
这是负责生成此折扣的代码部分
<span class="save_discount_pro">
{% if current_variant.compare_at_price > current_variant.price %}
{% if settings.show_discount_amount == 'percent_save' %}
<span class="per_discount">
{% comment %}
{% endcomment %}
{% assign money_pro_format = shop.money_format | strip_html | json %}
{% if money_pro_format contains "${{amount_no_decimals}}" or money_pro_format contains "${{amount_no_decimals_with_comma_separator}}" %}
{{ current_variant.compare_at_price | minus: current_variant.price | times: 100.0 | divided_by: current_variant.compare_at_price | times: 100 | money_without_currency | replace:",","." | replace: '.0', '' }}{{ 'products.product.on_save' | t }}
{% elsif money_pro_format contains "${{amount_with_comma_separator}}" %}
{{ current_variant.compare_at_price | minus: current_variant.price | times: 100.0 | divided_by: current_variant.compare_at_price | money_without_currency | replace:",","." | times: 100 | replace: '.0', '' }}{{ 'products.product.on_save' | t }}
{% else %}
{{ current_variant.compare_at_price | minus: current_variant.price | times: 100.0 | divided_by: current_variant.compare_at_price | money_without_currency | times: 100 | replace: '.0', ''}}{{ 'products.product.on_save' | t }}
{% endif %}
</span>
可以检测到代码有什么问题吗?
最好的问候,
【问题讨论】:
标签: themes shopify shopify-template