Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
Is there any way to update products in bulk
Like I want to update the status of products in bulk and update price of each product at once
You would need to make several callouts depending on how many products you are looking to update.
To use the api, see the documentation below:
https://shopify.dev/api/admin-rest/2022-10/resources/product#put-products-product-id
You would need the product ids to edit products
Hi @fahadali 👋
With GraphQL, you can use bulk operations that are designed to handle large volumes of data asychronously. To update the product status and variant prices, you can use the `bulkOperationRunMutation` with the `productUpdate` mutation and upload a JSONL file containing the input variables to a staged target.
mutation {
bulkOperationRunMutation(
mutation: "
mutation productUpdate($input: ProductInput!) {
productUpdate(input: $input) {
product {
id
status
variants (first:10){
nodes {
id
price
}
}
}
}
}",
stagedUploadPath: "...") {
bulkOperation {
id
url
status
}
}
}
Each input line would be formatted similar to the below:
{
"input": {
"id": "gid://shopify/Product/987654321",
"status":"DRAFT",
"variants": [
{
"id": "gid://shopify/ProductVariant/123",
"price": 111
},
{
"id": "gid://shopify/ProductVariant/456",
"price": 222
}
]
}
}
Hope that helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog