Hello!
I have a site and I have some products with varients (size, color etc). I already add SKU for those also. Now I have to change some color varients. is it effect SKU? SKU is very important for the business.
Any app you know?
Hello!
I have a site and I have some products with varients (size, color etc). I already add SKU for those also. Now I have to change some color varients. is it effect SKU? SKU is very important for the business.
Any app you know?
Hi Araf,
If you are looking to update color variants and SKUs in bulk you can achieve this with GraphQL using the productVariantsBulkUpdate mutation. This mutation allows you to update multiple variants in a single product. Below is an example of how you can construct this mutation to update SKUs:
mutation UpdateProductVariantsSKUs($productId: ID!, $variants: [ProductVariantsBulkInput!]!) {
productVariantsBulkUpdate(productId: $productId, variants: $variants) {
product {
id
}
productVariants {
id
sku
}
userErrors {
field
message
}
}
}
Example variables for this could look like:
{
"productId": "gid://shopify/Product/20995642",
"variants": [
{
"id": "gid://shopify/ProductVariant/30322695",
"sku": "NEW-SKU-001"
},
{
"id": "gid://shopify/ProductVariant/113711323",
"sku": "NEW-SKU-002"
},
{
"id": "gid://shopify/ProductVariant/236948360",
"sku": "NEW-SKU-003"
}
]
}
This mutation will update the SKUs of the specified product variants. Make sure your app has the necessary permissions and access scopes (write_products
) to perform this GraphQL operation.
As an alternative, you can also bulk edit SKUs of product variants directly within the Shopify admin. On the product admin page, within the variants card you can select the variants and then use the “Bulk edit” button. The bulk editor will then allow you to update SKUs for the selected variants.
I hope this helps
Thank you @Nic-Shopify