Add Product to Price List
Adds a single product to a price list. To change the prices of a product that is already in the list, use Update Single Price List Product.
HTTP Request
- URL:
/priceList/{id}/product - Method:
POST - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_PRICELIST
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the price list. |
Request Body
Send the product and its prices.
| Field | Type | Required | Description |
|---|---|---|---|
product | String | Yes | ID of the product to add. |
price | Number | No | Price of the product in this price list. |
discount | Number | No | Discount percentage off the product's regular price. Used when price is not sent. |
tierPrice | Array | No | Quantity-based prices for the product. |
variants | Array | No | Variant prices. |
The variant and tier price objects are the same as in Create Price List.
cURL Example
curl --location '<BASE_URL>/priceList/66ad153dbf8641f96544341d/product' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"product": "66b4a01249e6ce3d41c428fa",
"variants": [
{ "variantId": "66d5a286fcb786834cebb167", "price": 110 },
{ "variantId": "66d5a286fcb786834cebb168", "discount": 15 }
]
}'
Response
- 200 OK: The request was processed. If the price list was not found, or the product is already in the price list,
successisfalseandmessageexplains why. - 400 Bad Request: The access token is missing or invalid, the request body is empty or not valid, or the product or a variant was not found.
Sample JSON Response
{
"success": true,
"message": "Product added to price list successfully",
"data": {
"_id": "66ad153dbf8641f96544341d",
"name": "Wholesale Tier A",
"status": true,
"createdAt": "2024-08-02T17:19:57.270Z",
"updatedAt": "2024-10-03T11:07:39.081Z",
"id": "66ad153dbf8641f96544341d"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Object | The price list's id, name, status and timestamps. |
Notes
- To see the saved prices, use Get Price List.