How do I export a list of Shopify product URLs for each collection that a product is part of?

When creating a Product export, you can use the formula below under the Calculated Fields section of the Data Settings to export a comma-separated list of product URLs for each collection that the product is part of:

",".join(["https://" + {{ _shop_domain }} + "/collections/" + i + "/products/" + {{ handle }} for i in to_list({{ smart_collections.handle }}) + to_list({{ custom_collections.handle }})])

The output will look something like this:

https://www.example.com/collections/best-sellers/products/sleeping-cat,https://www.example.com/collections/on-sale/products/sleeping-cat

Please note that if you have a lot of products, the export can be very slow as pulling the collection data will require at least 2 additional API calls per product (since Shopify has 2 different types of collections which have separate API endpoints).


Related Articles:


App: EZ Exporter

Tags: collections, shopify urls