0
votes

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 i.e(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)

1
It sounds like it is rounding 2.50, so if you've divided by 100, then you'll need to times it back up by 100 before applying the money filter.mikenewbuild
i got my solution i was using money_without_currency earlierMohammad Fahad Rao

1 Answers

0
votes

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.