首页 > 解决方案 > 货币过滤器在计算液体 shopify 中给出磨损答案

问题描述

我正在尝试使用我的产品显示折扣后的金额。它在计算中工作正常

例如,我的总价是 500,折扣是 50%,我得到的答案是 250,这是正确的,但是当我使用货币过滤器显示货币单位时,即(卢比)它给出的错误答案是卢比。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 卢比)

标签: shopifyliquid

解决方案


我得到的解决方案是在使用它时删除money_without_currency过滤器,因为我很困惑液体语言需要数据类型转换,我之前使用过它。


推荐阅读