Focusing on managing products, variants, and collections through the API.
So basically I want to query the media for products and variants, in bulk, but I need to be able to get the media in the original order. As I understand from the docs, the connections will go to their own rows in the JSONL file, right after the parent, which is nice. But the order of the connected nodes is not preserved, and might even change between queries.
Another issue is that as I'm querying based on `productVariants`, it then becomes impossible to discern whether some given media row is a variant media or product media.
In other words, if I have a query like:
mutation { bulkOperationRunQuery( query: """ { productVariants { edges { node { id title price media { edges { node { id mediaContentType ... on MediaImage { image { url } } } } } product { media { edges { node { id mediaContentType ... on MediaImage { image { url } } } } } } } } } } """ ) { bulkOperation { id status } userErrors { field message } } }
I will be getting results which are something like:
{"id":"gid:\/\/shopify\/ProductVariant\/44409384698010","title":"Special Selling Plans Ski Wax","price":"49.95"} {"id":"gid:\/\/shopify\/MediaImage\/31462395543706","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/wax-special.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384698010"} {"id":"gid:\/\/shopify\/MediaImage\/31462395510938","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/snowboard_wax.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384698010"} {"id":"gid:\/\/shopify\/MediaImage\/31462395543706","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/wax-special.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384698010"} {"id":"gid:\/\/shopify\/MediaImage\/31462395576474","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/sample-normal-wax.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384698010"} {"id":"gid:\/\/shopify\/ProductVariant\/44409384730778","title":"Sample Selling Plans Ski Wax","price":"9.95"} {"id":"gid:\/\/shopify\/MediaImage\/31462395576474","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/sample-normal-wax.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384730778"} {"id":"gid:\/\/shopify\/MediaImage\/31462395510938","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/snowboard_wax.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384730778"} {"id":"gid:\/\/shopify\/MediaImage\/31462395543706","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/wax-special.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384730778"} {"id":"gid:\/\/shopify\/MediaImage\/31462395576474","mediaContentType":"IMAGE","image":{"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0628\/8424\/9754\/products\/sample-normal-wax.png?v=1706913223"},"__parentId":"gid:\/\/shopify\/ProductVariant\/44409384730778"}
and as I explained, there's no way to know which MediaImage is a product image or variant image (I can't seem to be able to alias the connections for example, the alias is ignored and doesn't appear anywhere in the output), and what is the actual order in the product/variant of those images.
I'd really like to avoid having to query each product or variant at a time just to find out the image ordering.
Thanks for any help!