簡體   English   中英

貨幣過濾器在計算液中給出磨損的答案 shopify

[英]Money filter giving worng asnwer in calculations liquid 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 盧比)

我得到的解決方案是在我使用它時刪除money_without_currency過濾器,因為我很困惑流動語言需要數據類型轉換,我之前使用過它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM