We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Hide sections of the product page for certain collections

Hide sections of the product page for certain collections

hapq95
Visitor
2 0 0

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

Replies 2 (2)

PaulNewton
Shopify Partner
8031 688 1649

Hi @hapq95 👋 use alternate templates

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

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


MooseDesk
Shopify Partner
628 70 185

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" %} <!-- This section will be hidden for "Special Collection" --> {% else %} <!-- This section will be displayed for other collections --> <div class="section-to-hide"> <!-- Section content goes here --> </div> {% 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' %}
<!-- Code for the section to hide goes here --> {% else %} <!-- This will be shown for other collections --> {% 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.

MooseDesk_0-1727685516553.png

 

 

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

MooseDesk_1-1727685517033.png

 

 

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

 

Was your question answered? Giving MooseDesk's reply a Like or marking it as an Accepted Solution!


MooseDesk - #All-in-one Customer Support and Helpdesk Solution for Shopify Merchants

Install now. Be our early bird and get all features free forever.