Re: Is there a way to query products from the catalog applying filters?

@sberndt This can be done using the query API. You would need to make two calls to do it based on features, but depending on the size of your catalog, this is likely still preferable to querying the entire catalog.


1. You would use the query API to to a ZOQL query on the ProductFeature object to get the features you want to use to locate the products. From this query you would obtain a set of "ProductId" fields and store that


2. Use the set of ProductId fields to make a query for the Product object. In the WHERE clause of the ZOQL you can add up to 200 entries to avoid needing repeated calls (i.e. WHERE Id = id1 OR Id = id2 OR ....)


This will then return you the products that match your features. If you have more than 200 features, then you would need an additional product query for each set of 200. (i.e. 375 features needs 2 Product queries, 410 features needs 3 product queries, and so on)

View solution in original post