javascript - Dividing item.price in shopify -


I want to divide {{item.price}. Money_without_currency}} 1.21 I'm calling the item. Value in a hidden input value

  & lt; Input type = "hidden" name = "PRODUCT_PRICE _ {{forloop.index}}" value = "{{items .price | money_without_currency}}" & gt; When I do this below, this value shows that my test product is 100 as "100 / 1.21". Since understanding HTML does not do math. & Lt; Form name = "addToFavorites" method = "post" action = "contoso.com" & gt; & Lt; Input type = "hidden" name = "PARTNER_KEY" value = "34234234234234" & gt; & Lt; Input type = "hidden" name = "TOTAL_DOMESTIC_SHIPPING_CHARGE" value = "0" & ​​gt; {% {Input type = "hidden" name = "PRODUCT_ID_ {{forloop.index}}" value = "{{item.sku}}" for item in {Cart.items%} & Lt; Input type = "hidden" name = "PRODUCT_NAME_ {{forloop.index}}" value = "{{item.title}}" & gt; & Lt; Input type = "hidden" name = "PRODUCT_PRICE _ {{forloop.index}}" value = "({{item.price | money_without_currency}} / 1.21)" & gt; & Lt; Input type = "hidden" name = "PRODUCT_Q _ {{forloop.index}}" value = "{{item.quantity}}" & gt; & Lt; Input type = "hidden" name = "PRODUCT_SHIPPING_ {{forloop.index}}" value = "" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_1 _ {{forloop.index}}" value = "{{item.variant.title}}" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_2 _ {{forloop.index}}" value = "" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_3 _ {{forloop.index}}" value = "" & gt; {% Endfor%} & lt; / Form & gt;  

When I try to play with Javascript, it still posts the equation 100 / 1.21, not the solution

   & Lt; Input type = "hidden" name = "PARTNER_KEY" value = "987979879879879" & gt; & Lt; Input type = "hidden" name = "TOTAL_DOMESTIC_SHIPPING_CHARGE" value = "0" & ​​gt; & Lt; Input type = "hidden" name = "ORDER_CURRENCY" value = "EUR" & gt; {% {Input type = "hidden" name = "PRODUCT_ID_ {{forloop.index}}" value = "{{item.sku}}" for item in {Cart.items%} & Lt; Input type = "hidden" name = "PRODUCT_NAME_ {{forloop.index}}" value = "{{item.title}}" & gt; & Lt; Input type = "hidden" id = "euPrice" & gt; & Lt; Input type = "hidden" name = "PRODUCT_Q _ {{forloop.index}}" value = "{{item.quantity}}" & gt; & Lt; Input type = "hidden" name = "PRODUCT_SHIPPING_ {{forloop.index}}" value = "" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_1 _ {{forloop.index}}" value = "{{item.variant.title}}" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_2 _ {{forloop.index}}" value = "" & gt; & Lt; Input type = "hidden" name = "PRODUCT_CUSTOM_3 _ {{forloop.index}}" value = "" & gt; {% Endfor%} & lt; / Form & gt;  

My last goal is to take the $ 100 product, discounts up to 21%, and please help by splitting up the item 1.21 before posting the information.

You can use the math filter:

  {{ Item.price | Split_b: 1.21 | Money_without_currency}}  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -