简体   繁体   中英

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. 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

{% 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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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