【发布时间】:2021-05-08 07:58:13
【问题描述】:
我正在尝试显示我的产品打折后的金额。计算效果很好
例如,我的总价是 500,折扣是 50%,我得到的答案是 250,这是正确的,但是当我使用货币过滤器显示货币单位时,即(Rs.)它给出的错误答案是 Rs。 3
My code that gives correct output but without currency unit
{% assign percent_calculated = section.settings.custom_discount_title | times: productprice | divided_by: 100 %}
<span href="https://wdtcv.myshopify.com/discount/discount%2520code%2520promo" style="color:#FFDAB9" >{{ productprice |minus : percent_calculated }} </span></div>
OUTPUT
250
我想将其显示为卢比。 250 但为了实现这一点,我使用“|money”过滤器并得到错误的答案
{% assign percent_calculated = section.settings.custom_discount_title | times: productprice | divided_by: 100 %}
<span href="https://wdtcv.myshopify.com/discount/discount%2520code%2520promo" style="color:#FFDAB9" >{{ productprice |minus : percent_calculated | money }} </span></div>
OUTPUT
卢比。 3(答案应该是 250 卢比)
【问题讨论】:
-
听起来好像是 2.50,所以如果你除以 100,那么你需要在应用货币过滤器之前将它乘以 100。
-
我得到了我之前使用 money_without_currency 的解决方案