Hide a product from product recommendations

Highlighted
Tourist
13 0 0

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 %}

 

0 Likes
Highlighted
New Member
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!

0 Likes
Highlighted
Tourist
13 0 0

Nope, I was never able to figure it out.

0 Likes