How To Add Subcategories In Shopify
Last modified: December 2, 2021
Or go to our Shopify Theme Detector directly
A collection is a group of products that are determined, by you, to be relevant to one another. For example, t-shirts, pants, socks, hats, etc.. By using categories, you can make it easier for your shoppers to find the products they want and easier for you to manage.
However, sometimes, you want to group products into subcategories, which is when categories are grouped into smaller groups (like red t-shirts, blue t-shirts, etc.).
Check Your Theme Settings
The first step is to check your theme’s settings. Most have a dropdown menu which allows you to add subcategories to your store. Check the settings with these steps.
Step 1 – Login
Log into your Shopify admin. Then go to your ‘Themes’ page and then find your current theme and click on the ‘Customize’ option. Within this section, look for and click on ‘Collection Page’ in the theme preview.
Step 2 – Collections Page
Within the ‘Collections Page’ tab in the editor, the theme should have an option to filter with tag that will be labeled as ‘Enable Filtering By Product Tag’. Click on the checkbox (if it isn’t already).
You can then click on save.
Step 3 – Add Option
If there’s no option within the theme file, you can add the option through the theme code. To do this, go back to the ‘Themes’ page and on your theme click on the ‘Actions’ option and then ‘Edit Code’.
Step 4 – Layout Directory
Within the layout directory, find the liquid file and click on it. At the bottom of the file find the tag and paste the following code just before that tag.
<script> /* Product Tag Filters – Good for any number of filters on any type of collection pages */ var collFilters = jQuery(‘.coll-filter’); collFilters.change(function() { var newTags = []; collFilters.each(function() { if (jQuery(this).val()) { newTags.push(jQuery(this).val()); } }); if (newTags.length) { var query = newTags.join(‘+’); window.location.href = jQuery(‘{{ ‘tag’ | link_to_tag: ‘tag’ }}’).attr(‘href’).replace(‘/’ + ‘tag’, ‘/’ + query); } else { {% if collection.handle %} window.location.href = ‘/collections/{{ collection.handle }}’; {% elsif collection.products.first.type == collection.title %} window.location.href = ‘{{ collection.title | url_for_type }}’; {% elsif collection.products.first.vendor == collection.title %} window.location.href = ‘{{ collection.title | url_for_vendor }}’; {% endif %} } }); </script>
Step 5 – Save
When you’ve finished, click on ‘Save’. The option to add subcategories to your products should now be available within your theme.
Final Word
Categories are a great way to help your site be easier to navigate. This can help with SEO and improve conversions on your website.