Development discussions around Shopify APIs
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
User | RANK |
---|---|
10 | |
4 | |
3 | |
3 | |
3 |
We're excited to announce improvements to the threaded messaging experience in our communi...
By TyW May 31, 2023Thank you to everyone who participated in our AMA with Klaviyo. It was great to see so man...
By Jacqui May 30, 2023Photo by Marco Verch Sales channels on Shopify are various platforms where you can sell...
By Ollie May 25, 2023