Update Product Group
Updates the details of an existing product group. You can also add products to the group or remove products from it.
HTTP Request
- URL:
/productGroup/update/{id} - Method:
PUT - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_PRODUCTGROUP
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the product group to update. |
Request Body
Send only the fields you want to change.
| Field | Type | Required | Description |
|---|---|---|---|
name | String | No | New name of the product group. |
status | Boolean | No | Whether the product group is active. |
restrictAccess | Boolean | No | Hide the group's products from shoppers who are not given access. |
hiddenFrom | Array | No | Shopper types to hide the group's products from: guest, b2c. Replaces the current list. |
products | Array | No | IDs of products to add to the group. |
productsToRemove | Array | No | IDs of products to remove from the group. |
cURL Example
curl --location --request PUT '<BASE_URL>/productGroup/update/66d220c8f57178681728212e' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Power Tools - Pro",
"hiddenFrom": ["guest"],
"products": ["64f123abc456789012345680"],
"productsToRemove": ["64f123abc456789012345678"]
}'
Response
- 200 OK: The product group was updated successfully.
- 400 Bad Request: The access token is missing or invalid, a value is not valid, or a product in
productswas not found. - 404 Not Found: No product group matches the ID.
Sample JSON Response
{
"success": true,
"message": "ProductGroup updated Successfully",
"data": {
"_id": "66d220c8f57178681728212e",
"name": "Power Tools - Pro",
"status": true,
"restrictAccess": false,
"hiddenFrom": ["guest"],
"createdAt": "2024-08-30T19:43:04.216Z",
"updatedAt": "2024-10-18T08:41:12.004Z",
"id": "66d220c8f57178681728212e"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Object | The updated product group. See Get All Product Groups. |
Notes
- Products already in the group are not added twice.
- Send
hiddenFrom: []to stop hiding the group's products from any shopper type.