Hide a product from product recommendations

nealm759
Excursionist
35 0 2

I have hidden products from recommendations based on a tag of hidden or product type hidden cart fee,  but instead of showing all four products it literally hides that product and only shows 3 products. Any ideas on how to correct this. Below is my code from product recommendation liquid file

 

 <div class="row" data-section-id="{{ section.id }}">
                {%- for product in recommendations.products -%}
                   {% unless product.tags contains 'hidden' or product.type contains 'hidden_cart_fee'%}
                    {% assign sold_out = true %}
                    {% if product.available %}
                        {% assign sold_out = false %}
                    {% endif %}
                    <div class="grid__item collection-image-anim wow zoomIn col-md-3 col-xs-6 indiv-product-wrapper{% cycle ' alpha mobile-clear tablet-clear', '', ' mobile-clear tablet-clear', ' omega' %}">
 
                        <div class="indiv-product">
 
                            <a href="{{ product.url | within: collection }}" title="{{product.title}}">
                                {% include 'responsive-image' with product.featured_image, alt: image.alt, props: '' %}
                            </a>
 
                            <div class="hp-title">
 
                                {% comment %}
                                Excluded for now
                                {% if section.settings.show-vendor %}
                                    <div class="indiv-product-vendor-text">{{ product.vendor | link_to_vendor }}</div>
                                {% endif %}
                                {% endcomment %}
 
                                <a href="{{ product.url | within: collection }}">
                                    <div class="indiv-product-title-text">{{ product.title }}</div>
                                   <span class="money-styling">
        {% if product.metafields.custom_fields["as_low_as"] != blank %}
    <div class="custom-field--value">
      As Low As {{ product.metafields.custom_fields["as_low_as"] }}
    </div>
 
                      {% elsif product.compare_at_price_max > product.price %}
        <span class="compare-at-price"><span class="money">{{ product.compare_at_price_max | money }}</span></span>
       
                {% elsif product.price_varies %}
                    <small>{{ 'products.general.from' | t }}</small> <span class="money">{{ product.price_min | money }}</span>
                {% else %}
                    <span class="money">{{ product.price_min | money }}</span>
                {% endif %}
        </span>
                                </a>
                            </div>
                        </div>
 
                        {% assign first_variant = product.variants[0] %}
                        {% include 'unit-price-measurement-grid', variant: first_variant %}
 
                        {% if product.compare_at_price_max > product.price and product.available and settings.sale_badge %}
                            <div class="sale-badge">{{ 'products.general.sale' | t }}</div>
                        {% endif %}
 
                        {% if settings.sold_out_badge and product.available == false %}
                            <div class="sold-out-badge">{{ 'products.product.sold_out' | t }}</div>
                        {% endif %}
                    </div>
              {% endunless %}

 

Replies 8 (8)

jeremyholograms
Visitor
2 0 0

I'm working on a JavaScript solution, but haven't quite gotten there yet. Have you figured it out yet? I have the same issue on my site...let me know if you do, and otherwise if I figure it out I'll give you my solution here!

nealm759
Excursionist
35 0 2

Nope, I was never able to figure it out.

Paul_Andrew
Explorer
58 0 14

Im also keen to figure this out. I love the idea of product recommendations but we have a hidden custom options feature that we would really like to hide from this recommendation bar which normally (disabled for now) appears at the bottom of each product listing. If anyone has found the code to implement that would be great, realistically need to hide certain products either by tag or vendor via liquid if possible and Im sure the code will need to go in the product_recommendations.liquid file

Wizard Patch Custom Embroidered Patches, Over 300,000 patches in stock with same day shipping from Sydney Australia, suppliers to Biker communities, all clubs and organizations and to the film and TV industry worldwide. wizardpatch.com

marievett
Tourist
6 0 3

I'm also interested. I am using Route (package protection) and right now you see that as a product that gets displayed here, I had a little work around for hiding it in my collections. But I can't seem to hide it from the Recommended Products section,

Jesper20
Shopify Partner
29 1 4

Let me know if anyone still got this problem, I can help

ambrass
Visitor
3 0 0

Hi Jesper - can you help me? I just want to hide one product from the dynamic You May Also Like recommended products.  It is a gift ribbon that we use for gift wrap - we have to have it as a product per the app we use.  But I don't want it to show up because people can't buy it individually and it also looks weird. Help!

 

ambrass_0-1660686566581.png

 

Paul_Andrew
Explorer
58 0 14

iF YOU HAVE A SOLUTION PLEASE POST IT PUBLICLY FOR ALL TO SEE.

Wizard Patch Custom Embroidered Patches, Over 300,000 patches in stock with same day shipping from Sydney Australia, suppliers to Biker communities, all clubs and organizations and to the film and TV industry worldwide. wizardpatch.com
nealm759
Excursionist
35 0 2

What is the solution?