Skip to main content

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​

ParameterTypeDescription
idStringRequired. The ID of the product group to update.

Request Body​

Send only the fields you want to change.

FieldTypeRequiredDescription
nameStringNoNew name of the product group.
statusBooleanNoWhether the product group is active.
restrictAccessBooleanNoHide the group's products from shoppers who are not given access.
hiddenFromArrayNoShopper types to hide the group's products from: guest, b2c. Replaces the current list.
productsArrayNoIDs of products to add to the group.
productsToRemoveArrayNoIDs 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 products was 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​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataObjectThe 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.