Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
We are trying to update product multiple variants stock/quantity using GraphQL Admin API and we are follow the instruction from Shopify docs (https://shopify.dev/docs/api/admin-graphql/2025-01/mutations/productVariantsBulkUpdate) but it is not working and it is returning below error
{"errors":[{"message":"syntax error, unexpected COLON (\":\"), expecting VAR_SIGN at [1, 37]","locations":[{"line":1,"column":37}]}]}
We are using PHP cURL and here code
$query = <<<QUERY
mutation productVariantsBulkUpdate($variants: [ProductVariantsBulkInput!]!, $productId: ID!) {
productVariantsBulkUpdate(variants: $variants, productId: $productId) {
product {
id
}
productVariants {
id
price
}
userErrors {
code
field
message
}
}
}
QUERY;
$variants = [
"productId" => "gid://shopify/Product/7128034803775",
"variants" => [["id"=>"gid://shopify/ProductVariant/40003114434623", "price"=>"12.00"],
["id"=>"gid://shopify/ProductVariant/40012127830079", "price"=>"6.00"]],
];
Can you please guide me. what is missing/wrong
Thanks!