Product Discounts [API]
Product Discounts define whether a product has a discount (percentage or fixed value) and from which ordered quantity the discount applies.
Notes: A product and a pricelist must already exist because their ids are required.
| Description | List available Product Discounts |
| Action | GET |
| URL | <your URL here>/api/product_discounts |
| Sample request parameters | id_eq=11 --> search by product discount id product_code=PRD001 --> search by product code product_id_eq=4 --> search by product id product_id_eq=4&pricelist_id_eq=1 --> also filter by pricelist id |
| Sample Successful Response | [
{
"id": 11,
"product_id": 4,
"pricelist_id": 1,
"percentage": "10.0",
"from_quantity": "0.0",
"date_to": null,
"created_at": "2020-11-26T13:24:23.000+02:00",
"updated_at": "2020-11-26T14:46:37.000+02:00",
"price": "50.0",
"has_custom_price": false,
"date_from": null
},
{
"id": 12,
"product_id": 4,
"pricelist_id": 1,
"percentage": "0.0",
"from_quantity": "10.0",
"date_to": null,
"created_at": "2020-11-26T13:24:23.000+02:00",
"updated_at": "2020-11-26T14:46:37.000+02:00",
"price": "40.0",
"has_custom_price": true,
"date_from": null
}
]
|
| Description | Create a Product Discount |
| Action | POST |
| URL | <your URL here>/api/product_discounts |
| Sample request body | {
"product_id": 4,
"pricelist_id": 1,
"percentage": "20.0",
"from_quantity": "10.0",
"date_to": null,
"price": "40.0",
"has_custom_price": false,
"date_from": null
}
|
| Sample Successful Response | {
"id": 19,
"product_id": 4,
"pricelist_id": 1,
"percentage": "20.0",
"from_quantity": "10.0",
"date_to": null,
"created_at": "2020-11-26T13:24:23.000+02:00",
"updated_at": "2020-11-26T14:46:37.000+02:00",
"price": "40.0",
"has_custom_price": false,
"date_from": null
}
|
| Description | Update a Product Discount |
| Action | PATCH/PUT |
| URL | <your URL here>/api/product_discounts/ <id of Product discount> |
| Sample request bofy | {
"id": 12,
"product_id": 4,
"pricelist_id": 1,
"percentage": "20.0",
"from_quantity": "10.0",
"date_to": null,
"created_at": "2020-11-26T13:24:23.000+02:00",
"updated_at": "2020-11-26T14:46:37.000+02:00",
"price": "30.0",
"has_custom_price": false,
"date_from": null
}
|
| Sample Successful Response | {
"id": 12,
"product_id": 4,
"pricelist_id": 1,
"percentage": "20.0",
"from_quantity": "10.0",
"date_to": null,
"created_at": "2020-11-26T13:24:23.000+02:00",
"updated_at": "2020-11-26T14:46:37.000+02:00",
"price": "30.0",
"has_custom_price": false,
"date_from": null
}
|