Shopify Script Discount Message

1010101010
New Member
1 0 0

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)