Crave theme: Exclude products from related products if contains a certain tag

Topic summary

A user is attempting to modify the Crave theme’s related products section to exclude items tagged with ‘sell’.

The provided code snippet appears corrupted or reversed, making it difficult to parse the actual implementation. The code shows a <product-recommendations> component with standard Shopify Liquid templating for displaying related products based on product ID and section settings.

Key elements visible:

  • Related products section with configurable limit (products_to_show)
  • Grid layout with responsive column settings
  • Product card rendering with options for secondary images, vendor display, and ratings

Current status: The discussion lacks responses or solutions. The user needs guidance on implementing tag-based filtering logic within the Liquid template to conditionally exclude products containing the ‘sell’ tag from the recommendations output.

Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Hi I would like to remove certain related products if the product includes a ‘sell’ tag.

Here is my code:

{% if recommendations.performed and recommendations.products_count > 0 %}

{{ section.settings.heading }}

    {% for recommendation in recommendations.products %}
  • {% render 'card-product', card_product: recommendation, media_aspect_ratio: section.settings.image_ratio, show_secondary_image: section.settings.show_secondary_image, show_vendor: section.settings.show_vendor, show_rating: section.settings.show_rating %}
  • {% endfor %}
{% endif %}
1 Like