Hello,
I am wondering if anyone has added subdomains to their Shopify store, and associated different logos with each subdomain. For example: When visiting my.hello.myshopify.com the website looks as hello.myshopify.com does but has a red bird logo, when visiting your.hello.myshopify.com the website also looks the exact same but has a blue whale logo, etc.
I have been told this has to be done by editing the theme code, but has anyone done this before and possibly have any resources to explain how the theme code is edited to achieve this?
Thanks in advance!
To associate different logos with each subdomain in Shopify, you’ll need to modify your theme code. Here’s a general approach to achieving this:
-
Identify the sections or templates in your theme that include the logo code. Typically, the logo code is found in the header section or a dedicated logo section.
-
Duplicate the section or template file that contains the logo code for each subdomain you want to customize. For example, if you have two subdomains, my.hello.myshopify.com and your.hello.myshopify.com, you would create two duplicate files.
-
Rename the duplicated files according to your subdomains. For example, you can name them header.my.liquid and header.your.liquid.
-
Open each duplicated file and modify the logo code to display the desired logo for that subdomain. You can replace the logo image URL or use conditional logic to display different logos based on the subdomain.
-
In the original header section or template file, add code to detect the subdomain and include the appropriate logo section or template based on the subdomain. You can use Liquid code to achieve this. Here’s an example:
{% case request.host %}
{% when 'my.hello.myshopify.com' %}
{% section 'header.my' %}
{% when 'your.hello.myshopify.com' %}
{% section 'header.your' %}
{% else %}
{% section 'header' %}
{% endcase %}