Converting Money to integer?

Highlighted
Shopify Expert
68 0 36

Hi all,

First of all, this scripts editor is fantastic. As new features are added this thing is going to get super super cool. So my question:

Can the money object be converted to an integer count of cents so I can do comparisons? For example, to determine if a line price in cents is greater than a previously calculated integer?

Thoughts?

0 Likes
Highlighted
Tourist
4 0 1

Have you tried creating a new Money object using that previously calculated integer as Money.new(cents: yourInt) ?

0 Likes
Highlighted
Shopify Expert
68 0 36

Why would I try the most obvious thing??? :) 

Thanks much! 

0 Likes