Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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!
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025