Shopify / Shopify/liquid

Liquid `where` and `reject` Filters Not Working as Expected

Open
#1,915 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Report
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

The where and reject filters in Shopify Liquid are not functioning correctly. When used to filter collections based on properties like tags, they return incorrect results—often an empty array ([]) or null, even when matching products exist.

This issue directly impacted a Scheduled Drop, preventing products from displaying as expected. This led to a loss of visibility, sales, and customer engagement, which is critical for merchants who rely on Shopify for product launches.

There were no changes to the shop theme code in the past 4 weeks, yet due to this bug, the products did not appear as intended, revealing the issue.

Steps to Reproduce

Test Case 1: where Not Filtering Properly

{% assign test_array_filter = section.settings.collection.products | where: "tags", "contains", "foo" %}
<script>
  document.addEventListener("DOMContentLoaded", () => {
    console.log("Test WHERE filter:", {{ test_array_filter | json }});
  });
</script>

Expected: Returns an array of products with "foo" tag.
Actual: Returns null or an empty array ([]).

Test Case 2: reject Not Filtering Properly

{% assign products_to_display = section.settings.collection.products | reject: "tags", "contains", "bar" %}
<script>
  document.addEventListener("DOMContentLoaded", () => {
    console.log("Test REJECT filter:", {{ products_to_display | json }});
  });
</script>

Video:
https://www.loom.com/share/135d72b5c61d4441a86cd2da1aafa4c2

Expected: Returns all products excluding those tagged "bar".
Actual: Returns null or an empty array ([]).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the two Liquid template snippets against collection products with matching and non-matching tags, comparing the where and reject results with the expected arrays. Done means both filters return the correct products for the supplied tag conditions, with regression coverage added for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.