Hello I am using this mutation to reorder products.
PHP extract Inside a FOREACH that cycles every collection:
mutation collectionReorderProducts{
collectionReorderProducts(
id: "gid://shopify/Collection/' . $collectionid .'",
moves: [';
$counter = 0;
foreach ($sorted as $prod) {
$query .= '{ id: "gid://shopify/Product/' . $prod['id'] . '", newPosition: "' . $counter .'" },';
$counter++;
}
$query .= ']
)
{
job {
id
done
}
}
}';
It works fine for the first collection, but after that i get failed jobs.
["collectionReorderProducts"]=>
array(1) {
["job"]=>
array(2) {
["id"]=>
string(54) "gid://shopify/Job/64837486-07b8-4677-9e31-78d23dccc746"
["done"]=>
bool(false)
}
}
2 and after)
["collectionReorderProducts"]=>
array(1) {
["job"]=>
NULL
}
What should I do ? A bulk operation? and how?