Create a Wholesale Product
This endpoint allows you to create wholesale product.
POST
/wp-json/wholesale/v1/products
Body Parameters
Required
Type
Description
wholesale_price
no
array
Wholesale prices for each wholesale role.
categories
no
array
Wholesale Category IDs. This is needed to attach a proper wholesale meta data flag for the product.
wholesale_visibility_filter
no
array
The wholesale role keys that allowed to see the product.
ignore_cat_level_wholesale_discount
no
array
The "Disregard Product Category Level Wholesale Discount" option.
ignore_role_level_wholesale_discount
no
array
The "Disregard Wholesale Role Level Wholesale Discount" option.
wholesale_minimum_order_quantity
no
array
The "Wholesale Minimum Order Quantity" for each role
wholesale_order_quantity_step
no
array
The "Wholesale Order Quantity Step" for each
wholesale_quantity_discount_rule_mapping
no
array
The rules for "Product Quantity Based Wholesale Pricing" option.
Extra Properties for wholesale_quantity_discount_rule_mapping
wholesale_role
String
The wholesale role key
start_qty
Number
The min quantity of the quantity range in order to trigger the wholesale discount.
end_qty
Number
The max quantity of the quantity range in order to trigger the wholesale discount.
price_type
String
Either percent-price or fixed-price
wholesale_price
Number
The wholesale price/discount.
Postman
Create Wholesale Product with Wholesale Category
POST: /wp-json/wholesale/v1/products
{
"name" : "Premium Quality Test",
"type" : "simple",
"regular_price" : "21.99",
"categories": [
{ "id": 15 }, { "id": 20 }
]
}Prices Premium Properties:
POST: /wp-json/wholesale/v1/products
JSON Body:
{
"name" : "Premium Quality Test",
"type" : "simple",
"regular_price" : "21.99",
"wholesale_price" : {
"wholesale_customer" : "12",
"silver" : "13"
},
"wholesale_visibility_filter": "wholesale_customer",
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2",
"sample_role": "3"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6",
"sample_role": "7"
},
"ignore_cat_level_wholesale_discount": "yes",
"ignore_role_level_wholesale_discount": "yes",
"wholesale_quantity_discount_rule_mapping": [
{
"wholesale_role": "wholesale_customer",
"start_qty": "11",
"end_qty": "20",
"price_type": "percent-price",
"wholesale_price": "20"
}
]
}Note:
Since v1.27, it is now allowed to create both non-wholesale and wholesale products. Meaning providing wholesale_price is optional.
To disable the "Product Quantity Based Wholesale Pricing" option, set the value to empty string. Ex.
wholesale_quantity_discount_rule_mapping: ""Possible values for
price_typearepercent-priceorfixed-price.
Last updated
Was this helpful?