Create a general discount for specific wholesale role.
The response will list down all general discount currently set.
POST: /wp-json/wholesale/v1/general-discount/
JSON Body:
{
"wholesale_role": "wholesale_customer",
"wholesale_discount": "10"
}
Response:
{
"message": "Successfully created new general discount.",
"data": {
"Wholesale_bronze": 12,
"wholesale_customer": 10
}
}
Status: 400 Bad Request
The wholesale discount is already created. To fix this either perform update to update the discount or delete the discount then re-add new. See their respective sections.
POST: /wp-json/wholesale/v1/general-discount/
JSON Body:
{
"wholesale_role": {wholesale_role_key},
"wholesale_discount": "10"
}
Response:
{
"code": "wholesale_rest_general_discount_cannot_create",
"message": "General discount is already created for this wholesale role.",
"data": {
"status": 400
}
}
Status: 400 Bad Request
Non existing wholesale role.
POST: /wp-json/wholesale/v1/general-discount/
JSON Body:
{
"wholesale_role": {wholesale_role_key_invalid},
"wholesale_discount": "10"
}
Response:
{
"code": "wholesale_rest_general_discount_cannot_create",
"message": "The wholesale role does not exist.",
"data": {
"status": 400
}
}