Hide sections of the product page for certain collections

I would like to hide some sections of my product page, but just for certain collections.

Hi @hapq95 :waving_hand: use alternate templates

https://help.shopify.com/en/manual/online-store/themes/os20/theme-structure/templates#create-a-new-template

Hi, @hapq95

Thanks for reaching out to the community. We are MooseDesk, a comprehensive Live Chat, FAQ & Helpdesk App designed to elevate your customer support experience.

To hide certain sections of the product page for specific collections on Shopify, you can achieve this by adding a conditional Liquid code to your product template. Here’s a step-by-step guide:

Step 1: Identify the Section You Want to Hide

First, make sure you know which sections of the product page you want to hide. These are usually located in your product.liquid template or in a product section file (such as product-template.liquid).

Step 2: Add Conditional Logic Based on the Collection

You’ll need to modify the template to include conditional logic that checks if the product belongs to a certain collection. This can be done using Liquid’s collection object.

Example Code

Here’s an example of how you can hide a section based on the collection a product belongs to.

  1. Open your Shopify admin and go to Online Store > Themes.
  2. Click Actions > Edit code on your current theme.
  3. Find the product template file, typically under Sections or Templates, for example, product.liquid or product-template.liquid.
  4. Locate the section you want to hide.
  5. Surround it with a conditional statement.

{% if current_tags contains “Special Collection” %} {% else %}

{% endif %}

In this example:

  • Replace “Special Collection” with the name or handle of the collection you want to target.
  • Alternatively, you can use the collection handle, like so:

{% if collection.handle == ‘your-collection-handle’ %}

{% else %} {% endif %}

Step 3: Test Your Changes

After making the changes, preview your product pages to ensure the section is hidden or displayed correctly based on the collection.

This method should allow you to control which sections appear on product pages based on the collection they belong to.

I hope this answer addresses your question effectively. If you found it helpful, we’d appreciate a ‘LIKE’ for MooseDesk. If your issue is resolved, please mark this as 'SOLUTION’.

In the meantime, our MooseDesk Team is always here to help with customer support solutions. We’re passionate about improving your customer experiences through our Live Chat, FAQ, and Helpdesk App.

With MooseDesk, you can engage with customers through omnichannel support, manage inquiries with a robust ticket system, and provide quick responses.

  • Or you can let customers resolve questions faster with in-built FAQ, Order tracking module, and more.

Once again, keep up the fantastic work, and I wish you the best of luck in the future!