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
1295 228 266

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 10 (10)

BrewBrains
Shopify Partner
160 26 33

 

  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 Developer


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
160 26 33

@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 Developer


Need help with your store?

 sandeshpaudyal99@gmail.com

For quick response - Message Me : +9779851353732

Sweet_Savior_3
Shopify Partner
1375 104 148

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
1295 228 266

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

rebornstudios
Visitor
1 0 0

Hello, I am using the Palo Alto theme.  I've tried inserting the snippet, as shown in the correct file, but it is returning an error.  Do I need different syntax because of the theme?

 

Here's the code appearing on the page:

 

{%- if block.type == 'related' and product.collections.size > 0 -%}
<div id="{{ related_id }}" data-related-products data-limit="{{ product_recommendations_limit }}" data-product-id="{{ product.id }}" {{ block.shopify_attributes }}>
{%- if recommendations.performed and recommendations.products_count > 0 -%}
{{ headings_markup }}

<div class="carousel__container">
<div class="carousel carousel--inactive carousel--mobile"
data-slider
data-slider-id="related-slider--{{ section.id }}"
tabindex="0"
>
{%- for product in recommendations.products -%}

{%- assign animation_delay = forloop.index0 -%}
{%- render 'product-grid-item',
product: product,
carousel: true,
columns_mobile: columns_mobile,
animation_delay: animation_delay,
section_width: section_width,
animation_anchor: related_anchor
-%}
{%- endfor -%}

</div>
</div>
{%- endif -%}

Smeelah
Navigator
374 1 117

Did this work for you? It didn't work for me?

AnneLuo
Shopify Partner
1295 228 266

Hi, @Smeelah 

I can help you with it. So I need to access your store as a collaborator if possible. 

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

Rickyxane
Tourist
13 0 1

Hi @AnneLuo ,
Could you help me with the same problem please? I'm using symmetry theme

 

Apurva_CW
Shopify Partner
21 1 5

Hey @chameleon1 @rebornstudios @Smeelah 

Just jumping on this thread here. If you'd like to try a no-code approach to fixing this, our app ConvertWise lets you show relatively more accurate recommendations than Shopify. (Some of our clients have talked about getting better engagement on their product pages, & significantly better cart conversions as well)

You can also choose to exclude/hide certain products from being shown.

Apurva_CW_0-1739872972242.png

Happy to chat if you have any further questions:)

Apurva Chawla | Founder, ConvertWise
- Was my reply helpful? Please like & mark it as an accepted solution.
- See ConvertWise features in action, on my demo store.
- Try the ConvertWise app for free on your store.