Focusing on managing products, variants, and collections through the API.
Calls to the GraphQL collectionReorderProducts endpoint are returning a job ID, and when I query the ID, the job says "done", but the sort order of the collection is never changed; everything remains in the same position.
There are no errors returned and the sort order never changes. It looks like direct calls to the API and calls from the Shopify GraphQL app are working when there's only one move, but if I have more than 1, it doesn't update even though there are no errors.
Also, I haven't deployed any code changes in over a week and everything has been working fine until right now.
So, in other words, this works when there's only one move:
mutation { collectionReorderProducts( id: "Z2lkOi8vc2hvcGlmeS9Db2xsZWN0aW9uLzMxMjI0MDE0NDU3OQ==" moves: [ {id: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzc0MzUzNTExOTU4NDM=", newPosition: "0"} ] ) { job { id }, userErrors { message } } }
But this does not (when there's more than one move):
mutation { collectionReorderProducts( id: "Z2lkOi8vc2hvcGlmeS9Db2xsZWN0aW9uLzMxMjI0MDE0NDU3OQ==" moves: [ {id: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzc0MzUzNTExOTU4NDM=", newPosition: "0"}, {id:"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzcxOTQyODI3ODcwMTE=",newPosition:"1"} ] ) { job { id }, userErrors { message } } }
Some additional info...I have been able to determine that if I reverse the order of the moves, the mutation works. But if I leave them in order, the mutation fails.
So these moves do not work:
{id:"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzc0MzUzNTExOTU4NDM=",newPosition:"0"}, {id:"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzcxOTQyODI3ODcwMTE=",newPosition:"1"}
But this below does work:
{id:"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzc0MzUzNTExOTU4NDM=",newPosition:"1"}, {id:"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0LzcxOTQyODI3ODcwMTE=",newPosition:"0"}
The only different is the order of the moves. Listing them descending by newPosition works.
Unfortunately reversing the order isn't an option since it's baked into a few places. In any case, this seems to be a bug in the API at the moment. By the way, the title is misleading since the direct calls do not work per the notes above. Unfortunately I can't edit it anymore so, yeah 🙂
Confirming this is an issue we're also experiencing on one of our apps. We've seen reports from other apps as well.
We've managed to get it to work with a moves list of less than 11, however this is intermittent. I doubt it makes a difference, but we're using the product gid as the id.
Thanks @mattdenoronha , this is still an issue for us at this time. I think Shopify is working on it but I haven't heard any updates yet.
By the way, something we've noticed is that if we save the sort order in reverse (i.e. by newPosition descending) then it works. But If we save it ascending with more than 1 product, it doesn't work. Very strange but I'm doing this with just the API, not even the app now.
I can reproduce it with both the Shopify GraphQL app and with direct calls to the API.
Looks like this issue still exists. The only way I can get the sort call mentioned above to work, is to send the moves in descending order (newPosition descending). If I send the moves with newPosition in ascending order, the call fails with no errors.
Can anyone at @Shopify shed some light on this? Is it at all related to the active 500 issue?
Thanks very much.