NEW: AI Search & Discovery AgentExplore
Merchandising for Shopify MarketsLearn More
Refer & earn up to $1,000Refer Now
← Back to Help Center
Personalization

Context-Based Filters, Rules & Conditional Pins

Last updated April 7, 2026

Context-based features let you control which products appear in your recommendation widgets based on what the customer is currently viewing or has in their cart. These features are configured in recommendation templates and work automatically when customers browse your store.

Overview

There are three new capabilities available in your recommendation templates:

  • Context Match — Show or exclude products that share the same attribute (tags, vendor, product type, etc.) as the product(s) the customer is viewing or has in their cart.
  • Context Rules — Create mapping rules: when the context product has certain values, show (or exclude) products with different values. For example: when viewing a "summer" product, show "beach-accessories".
  • Conditional Pins — Pin specific products to a position only when the context product(s) match certain conditions.

Additionally, products already in the customer's cart are automatically excluded from all recommendation results.

Context Match

Context Match filters recommendation results based on the attributes of the product(s) the customer is currently viewing or has in their cart.

How to set up

  1. Go to a recommendation template and open a segment's Filters section.
  2. Select a parameter (e.g., Tag(s), Vendor, Product type).
  3. In the Condition dropdown, select Context match.
  4. Choose Show or Don't show from the inline dropdown.
  5. Optionally, narrow to specific values. Leave empty to match all values from the context product(s).
Condition dropdown showing Context match and Context rules options
Context Match filter UI showing Show/Don't show dropdown with optional value picker

Examples

  • Tag(s) + Show: Customer views a product tagged "summer" → recommendations show other products also tagged "summer".
  • Vendor + Don't show: Customer views a Nike product → recommendations exclude other Nike products (show complementary brands).
  • Product ID + Show: Only activate this segment when the viewed product is one of specific product IDs (comma-separated).

Context Rules

Context Rules let you create specific mappings between context product values and the products you want to show or hide. Unlike Context Match (which matches the same values), Context Rules map from one set of values to a completely different set.

How to set up

  1. Select a parameter and choose Context rules from the Condition dropdown.
  2. Each mapping row reads as a sentence: "When context product(s) has [values] → show/don't show products with [values]".
  3. Select values on the left (what the context product must have).
  4. Choose show or don't show from the middle dropdown.
  5. Select target values on the right (which products to include or exclude).
  6. Click + Add mapping to add more rules.
Context Rules UI showing mapping rows with When/Show/Don't show

Examples

  • When context product has tags "summer", "spring" → show products with tags "beach-accessories", "sunscreen".
  • When context product has tags "premium" → don't show products with tags "budget", "clearance".

Conditional Pins

Normally, pinned products always appear at their designated position. With Conditional Pins, you can make a pin only activate when the context product(s) match certain conditions.

How to set up

  1. In the Pin products in a position section, add a pinned product with its Product ID and Position.
  2. Click + Add condition (optional).
  3. Choose a field (tag, vendor, product type, product ID, or handle).
  4. Select or type the value(s). For tags/vendor/type you get a dropdown picker. For IDs and handles, use comma-separated values.
  5. Add multiple conditions — the pin activates when ALL conditions are met by at least one context product.

Examples

  • Pin product #12345 at position 1, only when context product has tag "summer" → pin appears only on summer product pages.
  • Pin product #99999 at position 2, only when context product has vendor "Nike" → promotes a Nike accessory only on Nike product pages.
Conditional Pin UI showing condition with tag dropdown

Automatic Cart Exclusion

Products already in the customer's cart are automatically excluded from all recommendation results. This prevents recommending products the customer has already decided to purchase.

This behavior is always active when cart data is available — no configuration needed.

What are "context product(s)"?

The context product(s) are the product(s) the customer is currently interacting with:

  • On a Product Detail Page (PDP): The context product is the single product being viewed.
  • On a Cart page or other pages: The context product(s) are all products in the cart. If any cart product matches a rule, it activates.

Important Notes

  • Context-based features are only available when editing templates (not individual collections).
  • Available for: Tag(s), Vendor, Product type, Handle, Product ID, and string metafields.
  • Pins without conditions continue to work as before — always visible.
  • You can combine context filters with regular filters and sorters in the same segment.