Create a Wholesale Variation
This API allows you to create wholesale variation.
Method
Endpoint
POST
/wp-json/wholesale/v1/products/{variable_id}/variations
Path parameters
Required
Type
Description
variable_id
yes
int
The variable ID.
Body Parameters
Required
Type
Description
wholesale_price
no
array
Wholesale prices for each wholesale role.
wholesale_visibility_filter
no
array
The wholesale role keys that allowed to see the product.
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
POST: /wp-json/wholesale/v1/products/123/variations
JSON Body:
{
"regular_price": "19.00",
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Red"
}
],
"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"
},
"wholesale_quantity_discount_rule_mapping": [
{
"wholesale_role": "wholesale_customer",
"start_qty": "11",
"end_qty": "20",
"price_type": "percent-price",
"wholesale_price": "20"
}
]
}Last updated
Was this helpful?