Hi,
How to update product variant by providing “SKU” or “handle” under “input” instead of providing “id” as input using GraphQL
The below code is not working:
mutation {
productVariantUpdate(
input: {
sku: "test123",
handle: "summer-dress"
price: "18.99"
}
)
{
productVariant {
id
price
sku
}
}
}
Hi,
I see this is a relatively old post with no response. Have you had any luck figuring out how to do this?
I’m facing the same issue right now (using productVariantUpdate using SKU to identify the variant).
Thanks
Hi,
Did you figure out using SKU as a product input?
Hi,
I have managed to do this using version 2024-07 and passing the sku through inventoryItem.
mutation UpdateProductVariant($input: ProductVariantInput!) {
productVariantUpdate(input: $input) {
productVariant {
id
}
userErrors {
field
message
}
}
}
{
"input": {
"id": "gid://shopify/ProductVariant/45499072184555",
"price": 4.99,
"inventoryItem": {
"sku": "SKU001"
}
}
}
You’re passing the “id”! The question was how do you update it with just the sku.