products.json price datatype

badgeAppTester_
Shopify Partner
19 0 5

Hi

I'am using products admin API to get the products data. I will get the price element inside variants in the form of string. can i get the price value in the form of float or integer.

Josh
Shopify Staff
Shopify Staff
1130 82 191

Hey there, 

 

The data types returned by the API cannot be changed when making a request. If you do require it to be a different type, that would be something that you'd have to change after receiving a response from us. 

0 Likes
SerresPion
Tourist
3 0 0

Hey Josh,

 

Can I kindly ask why monetary types are typed as strings in the API to begin with?

 

There may be a very valid reason, but still, that design choice can't help but have new Shopify developers feel concerned. More so since the doc doesn't give a single clue about it. No explanations, no parsing rules, no nothing.

 

Does my app have to expect non-numerical string values at some point? Must I expect different decimal separator characters depending on some settings? Or user preference?

 

What's the deal here?

0 Likes