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