In some usecase, we might need to connect the shopify store in sub domain ( For example: shop.mydomain.com ) instead of root domain ( mydomain.com )
In shopify documentation, they have explained about that sub domain integration but I think some steps are missing in that documentation. I created this article to explain about those missing information
In our case, we have our domain in namecheap.com and the DNS interface will be more over common to other Domain providers. You can also check your domain provider documentation for DNS setting.
Login into your domain name provider website. In order to connect sub domain with shopify, we need to add two records in DNS setting of your domain. For example: let us consider, we like to have shopify in shop.mydomain.com
1) A record with host as ‘shop’ and points to shopify IP address ( ie 22.214.171.124 )
Type – A record
Host – shop
Value – 126.96.36.199
2) CNAME record with host as ‘shop’ and points to ‘shops.myshopify.com’
Type – CNAME record
Host – shop
Value – shops.myshopify.com
Login into your shopify account and navigate to ‘Online store -> Domains’. There will be option called ‘Connect existing domain’ and click that option.
It will show text field to add your existing domain. In our case, it is ‘shop.mydomain.com’
Once you add it and save it.
Navigate to ‘Online store -> Domains ‘. You can see that newly added domain (‘shop.mydomain.com’ ) in that domain list. We need to change our newly added domain as primary domain in shopify, then only we can access our shopify store in that sub domain ( shop.mydomain.com )
Click that ‘change primary domain’ link at top right corner and it will show option to choose the primary domain and you need to select our sub domain
That’s all. Shopify store is now connected with your sub domain.
Note: DNS propagation will take some time 24-48 hours. Mostly it will be connected within few minutes. For rare cases, it will take 24-48 hours