Shopify 货币过滤器在计算中为worng asnwer
我想用我的产品显示折扣后的金额。它在计算中运行良好 例如,我的总价是500,折扣是50%,我得到的答案是250,这是正确的,但当我使用货币过滤器显示货币单位,即卢比时,它给出了错误的答案,即卢比3Shopify 货币过滤器在计算中为worng asnwer,shopify,liquid,Shopify,Liquid,我想用我的产品显示折扣后的金额。它在计算中运行良好 例如,我的总价是500,折扣是50%,我得到的答案是250,这是正确的,但当我使用货币过滤器显示货币单位,即卢比时,它给出了错误的答案,即卢比3 My code that gives correct output but without currency unit {% assign percent_calculated = section.settings.custo
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
提供正确输出但不带货币单位的我的代码
{%assign percent_computed=section.settings.custom_折扣| title | times:productprice |除以_:100%}
{{productprice |减去:百分比_计算}
输出
250
我想将其显示为Rs.250,但为了实现这一点,我使用了“金钱”过滤器并得到了错误的答案
{% 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
{%assign percent_computed=section.settings.custom_折扣_title |次:productprice |除以_:100%}
{{productprice |减:百分比|计算|货币}
输出
Rs.3(答案应该是Rs.250)我得到了一个解决方案,就是删除
货币,而不使用货币过滤器
我之所以使用它,是因为我对液态语言需要数据类型转换感到困惑,我之前使用过它。听起来好像是2.50,所以如果你除以100,那么在应用货币过滤器之前,你需要将它乘以100。我得到了我的解决方案,我之前使用的是货币而不是货币