It seems the the location
endpoint doesn’t expose anything about which location is the default for a store.
Yet within a store admin under Settings > Location, there is a default location.
Is there a reason this isn’t exposed in the Admin API?
It seems the the location
endpoint doesn’t expose anything about which location is the default for a store.
Yet within a store admin under Settings > Location, there is a default location.
Is there a reason this isn’t exposed in the Admin API?
The docs seem to indicate that the concept is deprecated, I guess with order routing rules anywhere could be default.
Hey folks - @JordanFinners is on point, at the moment the
isPrimary
field is deprecated. Right now, the best method for tracking this would be through metafields. For example:
mutation LocationMetafieldsSet($locationId: ID!) {
metafieldsSet(metafields: [
{
ownerId: $locationId
namespace: "custom"
key: "isdefault"
type: "boolean"
value: "true"
}
]) {
metafields {
id
namespace
key
value
type
ownerType
}
userErrors {
field
message
}
}
}
It’s not the most ideal for sure, since you’d technically have to know this beforehand or build an interface for the merchant to mark a location as the default/primary shipping location, but thought this may help
My understanding is that this change is related to shared/multi-origin shipping. That said, if you’d like to share any use cases you folks were thinking about when it comes to primary shipping locations, feel free to ping me here and I’d be happy to take a look.
Yeah using a metafield isn’t ideal really for a public app to manage this.
My understanding is that this change is related to shared/multi-origin shipping.
Hmm its a bit confusing then because the admin settings UI still has a ‘default location’ area, so a store does still have one. It’s rather frustrating not having the API’s align with this the admin UI.
@Luke - you’re right, it is a little unusual for sure. I’ll do some more investigating on this and loop back with you when I can confirm things/when I have some more context to share
Hey folks - just following up on this here
. I was able to speak with the team on this and it looks like the location query may help with this:
If you run the location query without a set ID, it will return the primary location information by default:
{
location {
id
name
}
}
Hope this helps - let me know if I can clarify anything here as always!
Ah that’s good to know, thanks @Alan_G. Certainly would still be good to have a primary/default field on the locations
endpoint
Otherwise we have to make 2 requests here still if we want to retrieve all locations and know which is the primary.