Shopify Script Discount Message

Shopify Partner
7 0 1

How can i show the discount amount as a string and not a money object with shopify scripts? 

This is my script:

currentPrice = line_item.line_price
newPrice = line_item.line_price * 0.80

discountAmount = currentPrice - newPrice

message = "You Save $#{discountAmount}.00!"

line_item.change_line_price(newPrice, message: message)

And it shows in output "You Save $#<Money: "88$">.00!"

Why is this so difficult to achieve? Is there no mechanism to cast this money object as a different type?



Replies 0 (0)