In this article, we'll explore the intricacies of hiding memberships from product collections effectively.
Here are the steps to hide membership from product collection -:
Add a hidden tag to membership products:
Go to your Shopify admin, click "Products," and then search for the membership products which are auto-created through the membership plans.
Open the product in Edit mode.
Add a tag named "hidden" from the product tag section.
Save the product.
Hide products from 'Shop All':
You'll need to modify your theme's code to exclude products from this collection in the 'Shop All' section.
Go to "Online Store" > "Themes" > "Actions" > "Edit code."
Find the file that controls your 'Shop All' collection (this may vary depending on your theme).
Add a condition to exclude products from the hidden collection.
Here's a sample code snippet that might help you exclude the products:
{% for product in collections['shop-all'].products %} {% unless product.tags contains 'hidden' %} <!-- Your code to display the product --> {% endunless %} {% endfor %}
Next➡️
💡Tips for Membership V2