- Storefront domain: This is the domain on which the store is hosted. Customers purchasing directly from the merchant would use this domain to browse and use the storefront. Example:
my-cool-store.com
. - Canonical domain: A unique domain used by Shopify to identify the store. Customers accessing the canonical domain directly will be redirected to the storefront domain by Shopify. The canonical domain is always a
myshopify.com
subdomain. Example:e8548f-63.myshopify.com
.
ShopifyApp.installationLink
resolver is set up to work with either a canonical or storefront domain:
Developer guidelines
When to use each domain
Most Rye API methods are designed to work specifically with the canonical domain. This means that in general you should prefer use of the canonical domain over the storefront domain. Merchants have a lot of flexibility with respect to how they configure their domains, which means it isn’t always obvious what the canonical domain should be given a storefront domain. The correct canonical domain forgymshark.com
, for instance, is not gymshark.myshopify.com
like you might assume! The correct canonical domain is gymsharkusa.myshopify.com
; gymshark.myshopify.com
is the canonical domain for their UK store.
Because it can be difficult to accurately determine the canonical domain upfront, the following operations accept either one of the two domains and will attempt to resolve the correct canonical domain for you:
All of these operations return a canonicalDomain
field on their payload which you can save and use for subsequent requests.
Example: Tracking a product
In this example, we’ll walk through the process of requesting a product by URL and saving the canonical domain for future use.1
Request a Shopify product
Here the publicly-accessible URL of the product is provided to
requestShopifyProductByURL
. The Sell Anything API will resolve the correct canonical domain while processing this requestAnimationFrame.2
Receive canonical domain
Note that the
canonicalDomain
field contains a different domain from the one provided to requestShopifyProductByURL
.3
Save the canonical domain
At this point, you’ll want to save the canonical domain somewhere so you can reference it later. The exact details of how you do this will depend on your tech stack; here, we’re using a SQL database:
4
Use the canonical domain
Now that you have the correct canonical domain saved, you can look it up and use it for future API calls.