Re: Hiding a product from recommendations

Solved

Hiding a product from recommendations

chameleon1
Visitor
2 0 0

Hi,

 

How can I hide a certain product from the recommendations/you may also like section? I'm using the Dawn theme.

 

Thanks heaps 🙂

Accepted Solution (1)

AnneLuo
Shopify Partner
733 142 149

This is an accepted solution.

You can try this code by following these steps:

Step 1: Add 'hidden' tag for the products you want to hidden.

AnneLuo_1-1716789197773.png


Step 2: Go to the online store ->Theme ->Edit Code.
Step 3: Find the related-products.liquid file and add code below to the file.

{% unless recommendation.tags contains 'hidden' %}


{% endunless %}

 

AnneLuo_0-1716789087334.png

Hopefully it will help you. If yes then Please don't forget hit Like and Mark it as solution!

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me   

Buy Me A Coffee

View solution in original post

Replies 5 (5)

BrewBrains
Shopify Partner
138 23 29

 

  1. Add a Tag to the Product:

    • Go to Products in Shopify admin.
    • Select the product and add a tag like hidden-recommendation.
  2. Edit Dawn Theme Code:

    • Go to Online Store > Themes.
    • Click Actions > Edit Code.
    • Open product-recommendations.liquid in the Sections folder.
    • Add this code inside the product loop:

 

 

 

 {% for recommendation in recommendations.products %}
  {% unless product.tags contains 'hidden-recommendation' %}
    <!-- Your product display code -->
  {% endunless %}
{% endfor %}
​

 

 

 

  • This code ensures that any product with the hidden-recommendation tag will be excluded from the recommendations section.

Was my reply helpful? Click Like to let me know!

Was your question answered? Mark it as an Accepted Solution and click like.

Was I helpful?

Buy me a coffee


Sandesh Paudyal |

| Shopify Partner


Need help with your store?

 sandeshpaudyal99@gmail.com

For quick response - Message Me : +9779851353732

chameleon1
Visitor
2 0 0

Hi. Thank you for your response. I clicked edit code and searched for product-recommendations.liquid but I don't have it. Any other name I could search for? 

BrewBrains
Shopify Partner
138 23 29

@chameleon1 

BrewBrains_0-1716784396998.png

 

If your dawn theme is 2.0 then the name should be the same. If not then access to the store is required for further investigation. 

 

Thanks

Was I helpful?

Buy me a coffee


Sandesh Paudyal |

| Shopify Partner


Need help with your store?

 sandeshpaudyal99@gmail.com

For quick response - Message Me : +9779851353732

Sweet_Savior_3
Shopify Partner
1261 100 124

Hello @chameleon1 


Welcome to Shopify Community.

 

Please check for related-products.liquid file

Don't forget to like and accept the solution to help others store owners.
Looking for an expert or Have any queries ? Send query to the Inbox
Coffee Tip ? Pay to shopify.dev.34@gmail.com
From Less To Further !!!

AnneLuo
Shopify Partner
733 142 149

This is an accepted solution.

You can try this code by following these steps:

Step 1: Add 'hidden' tag for the products you want to hidden.

AnneLuo_1-1716789197773.png


Step 2: Go to the online store ->Theme ->Edit Code.
Step 3: Find the related-products.liquid file and add code below to the file.

{% unless recommendation.tags contains 'hidden' %}


{% endunless %}

 

AnneLuo_0-1716789087334.png

Hopefully it will help you. If yes then Please don't forget hit Like and Mark it as solution!

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me   

Buy Me A Coffee