Filtering products by collection_id not working properly

  1. We should be able to exclude products with the collection by using the negation filters (“-collection_id” or “NOT collection_id”). However, this causes extremely unexpected behavior where it returns the same products multiple times, and the products still are in the collection.

  2. We should be able to mix and match this query with other fields. The way the documentation is worded sounds like it’s only supported to match along with specific other fields, which should be documented more clearly if that’s true. But this limitation should be removed if possible. But I’m seeing issues even when filtering along with supported fields. For example, adding the title field it only matches if the title exactly matches. And if you separate the two filters with “OR” it doesn’t match anything. Also matching multiple collections doesn’t seem to work.

Upon further testing, it seems connectives are not supported when using “collection_id”, as adding “AND” or “OR” matches nothing, but taking away the “AND” allows multiple fields to be included. But even that only works in some cases.

Overall it behaves very strangely and doesn’t follow the other rules of the Shopify query syntax, which is very disappointing. It basically only works correctly if you only want to filter by a single collection and nothing else.

@Liam-Shopify I hate to ping you, but this isn’t getting any attention :frowning:

Hi David,

These could be intentional limitations - let me dig into this to find out more.