Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

Shop Identification: Shop ID vs Shop Domain

ottero
Shopify Partner
18 0 7

Hey everyone!

 

What exactly is the intended way to identify a shop? Intuitively I would use the numerical shop ID to identify a shop and store information in our backend with that ID. But it seems that shopify is usually providing only the shop domain. Example: The webhook events provide metadata with the shop domain, but not the shop ID. If I want to use the ID, I have to make another request to get the actual shop ID using the domain for which I need the shop access token again (even though I don't want to use the admin API when handling the webhook event).

 

Using the domain for identifying a shop on our end seems error prone, as the domain can change.

 

Am I missing something? What do you use in your backend for shop identification?

Accepted Solution (1)
rhaveneers
Shopify Partner
6 2 4

This is an accepted solution.

A merchant can change the shop name, the one displayed to users, but not the shop domain. We use the xyz.myshopify.com domain as identifier, which must be unique and can not be changed.

 

rhaveneers_0-1680112015499.png

 

View solution in original post

Replies 4 (4)

rhaveneers
Shopify Partner
6 2 4

As far as I now, shop domain/shop name is unique and you can use this to identify the shop

ottero
Shopify Partner
18 0 7

Thank you @rhaveneers for the reply. Yes, the domain is unique. But it can be changed by the shop owner, right? If I store data for xyz.myshopify.com in my backend and later on the shop owner changes it to shop.xyz.com then my previously stored shop data doesn't match with the new domain.

rhaveneers
Shopify Partner
6 2 4

This is an accepted solution.

A merchant can change the shop name, the one displayed to users, but not the shop domain. We use the xyz.myshopify.com domain as identifier, which must be unique and can not be changed.

 

rhaveneers_0-1680112015499.png

 

zksumon
Shopify Partner
9 0 1

hi do you get the shop domain from request headers?