简体   繁体   English

货币过滤器在计算液中给出磨损的答案 shopify

[英]Money filter giving worng asnwer in calculations liquid shopify

I am tryign to display amount after discount with my product.我正在尝试使用我的产品显示折扣后的金额。 It works fine in calculation它在计算中工作正常

For example my total price is 500 and discoutn is of 50% i get my answer 250 which is correct but when i use money filter to display currency unit ie(Rs. ) it gives wrong answer which is Rs.例如,我的总价是 500,折扣是 50%,我得到的答案是 250,这是正确的,但是当我使用货币过滤器显示货币单位时,即(卢比)它给出的错误答案是卢比。 3 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 

I want to display it as Rs.我想将其显示为卢比。 250 but to achieve that i use "|money " filter and get wrong answer 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 

Rs.卢比。 3 (answer should be Rs. 250) 3(答案应该是 250 卢比)

I got the solution which was to remove money_without_currency filter as I used it because I was confused that liquid language requires data type casting you I used it a bit earlier.我得到的解决方案是在我使用它时删除money_without_currency过滤器,因为我很困惑流动语言需要数据类型转换,我之前使用过它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM