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

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

maternallyhappy
Explorer
49 0 12

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

 

maternallyhappy_0-1704346724660.png

 

Thanks heaps,

 

Caitlin

 

Replies 4 (4)

Liqiud_xPert_SJ
Shopify Partner
1031 125 155

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

- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂- If you need any technical assistance, feel free to send me a DM. You no longer have to search for answers without getting a response.
- Please don't forget to Like and Mark Solution to the post that helped you. Thanks!
- Your Shopify Solution Specialist For further discussion contact: Email ID- Liqud_3xPert_SJ OR Whatsapp
- Buy a Coffee for me to get more frequently help 🙂
- Hire Me to unlock the full potential of your e-commerce store Now 🙂
maternallyhappy
Explorer
49 0 12

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

 

maternallyhappy_0-1704353152173.png

 

maternallyhappy
Explorer
49 0 12

doesn't seem to work, thank you anyway

ManuelH
Explorer
83 4 13

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:

ManuelH_1-1719257190397.png

 

ManuelH_0-1719257128587.png

 

any idea how to change that?