Hello! I would need no product of a certain type to appear in the recommended products section of my store.
Could you help me? I don’t understand much of shopify code and haven’t found the answer in the forum.
The type of product I want to hide is “Envase”
This is the code that appears in products-recommendation.liquid
{%- if recommendations.performed -%}
{%- if recommendations.products_count > 0 -%}
{%- assign grid_strings = 'large-up--one-quarter medium--one-quarter small--one-whole' -%}
{%- for product in recommendations.products -%}
{% assign animation_delay = forloop.index0 | times: 1 %}
{%- assign layout_slide_attributes = 'data-slide="' | append: forloop.index0 | append: '" data-slide-index="' | append: forloop.index0 | append: '"' -%}
{% render 'product-grid-item', product: product, grid_strings: grid_strings, animation_delay: animation_delay, additional_attributes: layout_slide_attributes, animation_anchor: '#product-recommendations' %}
{%- endfor -%}
{%- endif -%}
{%- else -%}
{%- endif -%}
And this is the code that appears in related.liquid
{%- assign has_related_products = section.settings.related_products_enable -%}
{%- assign has_recently_products = section.settings.show_recently_viewed -%}
{%- if has_related_products and product.collections.size < 1 -%}
{% assign has_related_products = false %}
{%- endif -%}
{%- if has_related_products and has_recently_products != true -%}
- {%- if section.settings.product_recommendations_heading != blank -%}
##
{{- section.settings.product_recommendations_heading -}}
{%- endif -%}
-
{%- render 'products-recommendation', product: product -%}
{%- elsif has_recently_products and has_related_products != true -%}
-
- {%- if section.settings.product_recently_heading != blank -%}
##
{{- section.settings.product_recently_heading -}}
{%- endif -%}
{%- render 'products-recently-viewed', product: product, product_recently_limit: section.settings.product_recently_limit -%}
{%- elsif has_related_products and has_recently_products -%}
- {%- if section.settings.product_recommendations_heading != blank -%}
##
{{- section.settings.product_recommendations_heading -}}
{%- endif -%}
{%- if section.settings.show_recently_viewed -%}
- {%- if section.settings.product_recently_heading != blank -%}
##
{{- section.settings.product_recently_heading -}}
{%- endif -%}
{%- endif -%}
{%- render 'products-recommendation', product: product, limit: section.settings.limit -%}
{%- render 'products-recently-viewed', product: product, limit: section.settings.product_recently_limit -%}
{%- endif -%}
¡thanks!