How I can get the current currecy for my store in ajax call?

Shopify Partner
5 0 0

Hi there, trying to see if there is away to get the settings for mystore. Does anyone know how I can get the current settings for the store?

Thanks!

0 Likes
Shopify Staff
Shopify Staff
582 0 45

Why do you need the currency? If it's for simple formatting you can use Shopify.money_format and Shopify.formatMoney(cents) to generate the correct currency entries.

0 Likes
Shopify Partner
5 0 0

I built a JavaScript file to serve many clients (stores), one of them(stores) in "$" and the other in "pounds". so i don't want to save these settings in our DB .. so is there away to know what's the current currency for specific store name

0 Likes
Shopify Staff
Shopify Staff
582 0 45

Is the file run on the storefront or is it a node.js application? If it's storefront you can just use the methods I mentioned that are a part of the Shopify AJAX API.

If it's a node app you can hit /admin/shop.json which will include fields like currency, money_format and money_with_currency_format.

0 Likes
Shopify Partner
5 0 0

yes, it's from store front, and i don't have the access to use admin APIs.

I checked the Shopify AJAX API before, doesn't help I couldn't find the specific API for that.

I think if there are AJAX API for store settings to return all public info in GET AJAX call this will help.

0 Likes
Shopify Staff
Shopify Staff
582 0 45

There isn't a public API for what you are looking to do. The merchant can change whatever they want their formatting to look like in the admin and this is properly reflected via those Shopify AJAX API calls.

Here's admin settings I set in my Shop:

Here's the results from some calls to the Shopify AJAX API

0 Likes
Shopify Partner
5 0 0

how you get this value? can you give me example for the call.

Thanks

0 Likes
Shopify Partner
5 0 0

any update on this?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
582 0 45

I don't know where the official documentation is, but someone put together a little Shopify Javascript API sandbox thing you can play around with.

0 Likes