Skip to content

Liquid where and reject Filters Not Working as Expected #1915

Open
@spookyvert

Description

@spookyvert

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 ([]).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions