Our function checks whether each item in the cart belongs to specific collections.
Some of our larger customers have a high number of collections, and we need to check all of them using inCollections
.
With 30 items and 60 collections, we’re running into the input size limit.
This happens because the input contains 30 × 60 = 1800 blocks in the following format:
{
"collectionId": "gid://shopify/Collection/1234567890",
"isMember": false
}
This format consumes a lot of input space, causing us to hit the input size limit.
Please note: it’s not the instruction limit but the input size limit that is being exceeded.
Would it be possible to modify the return format of inCollections
so that it returns only a list of collectionIds
an item belongs to, instead of a list of objects containing both collectionId
and isMember
fields?
Or is there another way to achieve the same result without exceeding the input size limit?