Batch Update Variations
Last updated
Last updated
This API handles batch create, update and delete a wholesale or non-wholesale variations.
Batch update variations.
POST: /wp-json/wholesale/v1/products/{variation_id}/batch
JSON Body:
{
"create": [
{
"regular_price": "19.00",
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Red"
}
],
"wholesale_price": {
"wholesale_customer": "12"
},
"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"
}
]
}
],
"update": [
{
"id": 7083,
"wholesale_price": {
"wholesale_customer": "16"
},
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Yellow"
}
]
}
],
"delete": [
7075,
7074
]
}
Batch update products.
POST: /wp-json/wholesale/v1/products/{variation_id}/batch
JSON Body:
{
"create": [
{
"regular_price": "19.00",
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Red"
}
],
"wholesale_price": {
"wholesale_customer": "12"
},
"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"
}
]
}
],
"update": [
{
"id": 7083,
"wholesale_price": {
"wholesale_customer": "16"
},
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Yellow"
}
]
}
],
"delete": [
7075,
7074
]
}
Response:
{
"create": [
{
"id": 7084,
"date_created": "2021-10-21T04:17:18",
"date_created_gmt": "2021-10-21T04:17:18",
"date_modified": "2021-10-21T04:17:18",
"date_modified_gmt": "2021-10-21T04:17:18",
"description": "",
"permalink": "https://example.com/product/variable-test/?attribute_pa_color=red",
"sku": "",
"price": "19.00",
"regular_price": "19.00",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"status": "publish",
"purchasable": true,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_class": "",
"shipping_class_id": 0,
"image": null,
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Red"
}
],
"menu_order": 0,
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "12"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_enable_quantity_discount_rule": "yes",
"wwpp_quantity_discount_rule_mapping": {
"desc": "Quantity based discounts available based on how many items are in your cart.",
"mapping": [
{
"wholesale_role": "wholesale_customer",
"start_qty": "11",
"end_qty": "20",
"price_type": "percent-price",
"wholesale_price": "20"
}
]
}
}
}
],
"update": [
{
"id": 7083,
"date_created": "2021-10-21T04:00:46",
"date_created_gmt": "2021-10-21T04:00:46",
"date_modified": "2021-10-21T04:17:18",
"date_modified_gmt": "2021-10-21T04:17:18",
"description": "",
"permalink": "https://example.com/product/variable-test/?attribute_pa_color=yellow",
"sku": "",
"price": "19.00",
"regular_price": "19.00",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"status": "publish",
"purchasable": true,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_class": "",
"shipping_class_id": 0,
"image": null,
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Yellow"
}
],
"menu_order": 0,
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "16"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_enable_quantity_discount_rule": "yes",
"wwpp_quantity_discount_rule_mapping": {
"desc": "Quantity based discounts available based on how many items are in your cart.",
"mapping": [
{
"wholesale_role": "WholesaleBronze",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "12"
},
{
"wholesale_role": "wholesale_customer",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "7"
}
]
}
}
}
],
"delete": [
{
"id": 7075,
"date_created": "2021-10-20T13:23:09",
"date_created_gmt": "2021-10-20T13:23:09",
"date_modified": "2021-10-20T13:23:09",
"date_modified_gmt": "2021-10-20T13:23:09",
"description": "",
"permalink": "https://example.com/product/variable-test/?attribute_pa_color=black",
"sku": "",
"price": "19.00",
"regular_price": "19.00",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"status": "publish",
"purchasable": true,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_class": "",
"shipping_class_id": 0,
"image": null,
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Black"
}
],
"menu_order": 0,
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "12"
},
"wwpp_product_wholesale_visibility_filter": [
"all"
],
"wwpp_enable_quantity_discount_rule": "yes",
"wwpp_quantity_discount_rule_mapping": {
"desc": "Quantity based discounts available based on how many items are in your cart.",
"mapping": [
{
"wholesale_role": "WholesaleBronze",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "12"
},
{
"wholesale_role": "wholesale_customer",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "7"
}
]
}
}
},
{
"id": 7074,
"date_created": "2021-10-20T13:03:36",
"date_created_gmt": "2021-10-20T13:03:36",
"date_modified": "2021-10-20T13:03:36",
"date_modified_gmt": "2021-10-20T13:03:36",
"description": "",
"permalink": "https://example.com/product/variable-test/?attribute_pa_color=black",
"sku": "",
"price": "29.00",
"regular_price": "29.00",
"sale_price": "",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": false,
"status": "publish",
"purchasable": true,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"stock_status": "instock",
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_class": "",
"shipping_class_id": 0,
"image": null,
"attributes": [
{
"id": 1,
"name": "Color",
"option": "Black"
}
],
"menu_order": 0,
"wholesale_data": {
"wwpp_product_wholesale_visibility_filter": [
"all"
],
"wwpp_enable_quantity_discount_rule": "yes",
"wwpp_quantity_discount_rule_mapping": {
"desc": "Quantity based discounts available based on how many items are in your cart.",
"mapping": [
{
"wholesale_role": "WholesaleBronze",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "12"
},
{
"wholesale_role": "wholesale_customer",
"start_qty": "22",
"end_qty": "33",
"wholesale_discount": "7"
}
]
}
}
}
]
}
Method
Endpoint
POST
/wp-json/wholesale/v1/products/{variable_id}/batch