I’ve been looking for ways to programatically have a “scratch” collection that I could use to access data from various products, depending on dynamic criteria at runtime.
Is there a way to assemble or modify a collection of products based on their GID? Our site uses the bundler app to offer a group of products to be sold as a single product and I want to pull metadata from each product in the bundle. I can get the GID of each product but haven’t been able to create an array of product objects to pull info from, so it seemed a temporary/scratch collection (if it can be done) could fit the bill.
Ya know, it seems silly that one would need our store URL to answer this theoretical question but it also seems to be the first question anyone asks. What’s up with that?
In this context, it is returned from a product object as a unique identifier for that product.
My original goal was to assemble an array of objects based on some criteria and then iterate through the array. But liquid being what it is, that’s not quite so simple, One thing is we can’t seem to create an object (product or otherwise) on the fly. However, you can iterate through a collection of products and get the product object – but if I can’t modify the collection at runtime, that’s a dead end.