Our themes have the ability to show a custom, multi-level menu in the sidebar on collection pages. Many customers have asked us if it's possible to show a different menu on different collection pages. Due to Shopify limitations, this is not possible without some work. The good news is, there are a couple of options to resolve this issue.
Option 1: Create alternate collection templates
The easiest solution is to create alternate collection templates for each collection that requires a custom menu. This is the best option if you don't have lots of collections that require a custom menu. To do this, please follow these steps:
To do this, login to your Shopify dashboard and go to Online Store > Themes and look for the theme you wish to edit. Then click Actions > Edit Code, navigate to the Templates folder and click Add a new Template. Select collection as the template type, and give it a name. Within the new collection.alternate.liquid template, replace the existing code:
{% section 'collection' %}
with this code:
{% section 'collection-alternate' %}
Save the file.
Now, go to the Sections folder on the left and open the file called collection.liquid. Select all the code in this file and copy it to your clipboard. Then, under the Sections heading on the left menu, click the Add a new section link, type the name of your new collection template in the box (in this example, it should be collection-alternate), remove all the code from this file and paste in all the code you copied from the original collection.liquid file.
Save the file and you're done! Now you just need to assign this new template to your collection page. To do this, go to Online Store > Products > Collections and choose the collection to which you would like to add your unique sidebar. In the lower right corner of the page, select collection.alternate as the template and save.
Add the custom menu to the collection
Now that you have your alternate collection template, you will be able to assign a different menu to your collection. Head back to Online Store > Themes and click the Customize theme button next to the theme you wish to edit. From within the theme settings browser, navigate to the collection page that has the alternate collection template assigned. In the collection settings on the left, scroll down to the sidebar settings and choose the menu you wish to display.
Note that you will need to create a unique collection template and follow all the steps above for each collection that requires a custom menu.
Option 2: Edit the code to look for a menu with the same collection handle
If you have lots of collections in your store and want unique menus on each, creating alternate templates for each of them can be a very time-consuming process. In this case, a custom coding solution might be a better choice. Such a solution would require you to modify your collection template so the sidebar looks for a menu that has the same handle as your collection. So let's say you had a collection called Oil Paintings. The handle for this collection would likely be oil-paintings. With this custom coding applied, you could then create a navigation menu called Oil Paintings and add whatever menu items you want to it. That menu would then show on your collection page.
This solution would obviously require some coding knowledge. If you aren't comfortable with coding, please feel free to contact us and we'd be glad to provide a quote to complete the work for you.
Comments
0 comments
Please sign in to leave a comment.