Solved

How to get the default location using the REST API?

jimin-genie
Shopify Partner
5 0 5

In the Shopify store admin panel, you can set Default Location. And in the UI, the default location has Default tag showing up. However, when I look at the REST API to retrieve a list of locations (https://shopify.dev/docs/api/admin-rest/2023-10/resources/location#get-locations), there is no way for me to find out which one is the default location. Can anyone help?

 

jimingenie_0-1697201146592.png

 

Accepted Solution (1)

Joe47
Shopify Partner
18 1 8

This is an accepted solution.

You get can it from the shop object under primary_location_id

https://shopify.dev/docs/api/admin-rest/2023-10/resources/shop

View solution in original post

Replies 3 (3)

DBR7
Shopify Partner
1 0 0

Looking for the same.

Joe47
Shopify Partner
18 1 8

This is an accepted solution.

You get can it from the shop object under primary_location_id

https://shopify.dev/docs/api/admin-rest/2023-10/resources/shop

jimin-genie
Shopify Partner
5 0 5

Looks like in the latest REST API and GQL API have primary location fields `deprecated`.

 

REST API:

https://shopify.dev/docs/api/admin-rest/2024-04/resources/shop

GQL API:

https://shopify.dev/docs/api/admin-graphql/2024-04/queries/location

 

How do we find this information in a new way now?