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](https://shopify.dev/api/admin/graphql/reference/bulk-operations/bulkoperationrunmutation)
with the [productUpdate](https://shopify.dev/api/admin/graphql/reference/products-and-collections/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!