Using the GraphiQL app, I have been able to successfully reorder one product on one collection at a time doing the following…
How can I reorder multiple products on the same collection in one submission? I have tried a number of ways to build out an array in the variables section to no avail. Any help would be much appreciated!
Naturally, I searched for a day trying to find the answer before resorting to asking a question. Then what do you know, found something that would help.
Instead of passing the variables separately, I merged it into one query like so:
mutation {
collectionReorderProducts(
id: "gid://shopify/Collection/263143489615",
moves: [
{
id: "gid://shopify/Product/6608989978703",
newPosition: "0"
},
{
id: "gid://shopify/Product/4165523734607",
newPosition: "1"
},
{
id: "gid://shopify/Product/6566603522127",
newPosition: "2"
},
{
id: "gid://shopify/Product/4508904521807",
newPosition: "3"
},
{
id: "gid://shopify/Product/4335383707727",
newPosition: "4"
}
]
) {
userErrors {
field
message
}
}
}
And this worked to send all 5 requests in at once, only costing 10 pts. It would probably work if I structured it the same inside the query variables tab, but this will work better inside my PHP app.
Hope this helps someone else out in the future…