How can I hide a specific product from the recommended section?

Hi there,

I am wanting to hide a certain product from the recommended product section, if there any way of doing this? I have the prestige theme. www.maternallyhappy.com

The product is Myo-Inositol For PCOS

Thanks heaps,

Caitlin

Hi @maternallyhappy

Please follow the below instructiosn hopefully you get what you need also please accept the solution if it does work for you.

Go to “Online Store” > “Themes”.

Click on “Actions” > “Edit code”.

In the left-hand sidebar, click on “Sections” > “product-recommendations.liquid”.

Scroll down to the product_recommendations block to exclude specific products from the recommendations, you can add a where filter to the for loop that iterates through the recommended products. For example, if you want to exclude products with the tag “exclude-recommendations”, you can modify the loop as follows:

{% for product in product_recommendations.products %}
{% unless product.tags contains ‘exclude-product’ %}
// code to display recommended product
{% endunless %}
{% endfor %}

The unless statement checks if thetags property of the current product contains the “exclude-product” tag.

Thanks

Hi thank you for your help, unfortunately I don’t have that option under sections

doesn’t seem to work, thank you anyway

the code does what it should, however the product that is not displayed is then not replaced by another product and a empty spot is left:

any idea how to change that?

Hey, @ManuelH , I’m curious if you ever fixed the issue where hiding the product meant there was just an empty space where it should have been. Running into the same thing.