Batch Update Products
Last updated
Last updated
This API handles batch create, update and delete a wholesale or non-wholesale product.
Batch update products.
POST: /wp-json/wholesale/v1/products/batch
JSON Body:
{
"create" : [
{
"name" : "Premium Quality 1",
"type" : "simple",
"regular_price" : "21.99",
"wholesale_price" : {
"wholesale_customer" : "11"
}
},
{
"name" : "Premium Quality 2",
"type" : "simple",
"regular_price" : "21.99",
"wholesale_price" : {
"wholesale_customer" : "122"
},
"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"
},
{
"wholesale_role": "test",
"start_qty": "11",
"end_qty": "20",
"price_type": "percent-price",
"wholesale_price": "20"
}
]
}
],
"update": [
{
"id": 7425,
"name" : "Updated Title",
"wholesale_price" : {
"wholesale_customer" : "20"
}
},
{
"id": 7422,
"name" : "Updated Title 2",
"regular_price" : "22",
"wholesale_price" : {
"wholesale_customer" : "66"
}
}
],
"delete" : [7401, 7404]
}
Batch update products.
POST: /wp-json/wholesale/v1/products/batch
JSON Body:
{
"create" : [
{
"name" : "Premium Quality 1",
"type" : "simple",
"regular_price" : "21.99",
"wholesale_price" : {
"wholesale_customer" : "11"
}
},
{
"name" : "Premium Quality 2",
"type" : "simple",
"regular_price" : "21.99",
"wholesale_price" : {
"wholesale_customer" : "122"
},
"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"
},
{
"wholesale_role": "test",
"start_qty": "11",
"end_qty": "20",
"price_type": "percent-price",
"wholesale_price": "20"
}
]
}
],
"update": [
{
"id": 7425,
"name" : "Updated Title",
"wholesale_price" : {
"wholesale_customer" : "20"
}
},
{
"id": 7422,
"name" : "Updated Title 2",
"regular_price" : "22",
"wholesale_price" : {
"wholesale_customer" : "66"
}
}
],
"delete" : [7401, 7404]
}
Response:
{
"create": [
{
"id": 7080,
"name": "Premium Quality 1",
"slug": "premium-quality-1",
"permalink": "https://example.com/product/premium-quality-1/",
"date_created": "2021-10-21T02:35:25",
"date_created_gmt": "2021-10-21T02:35:25",
"date_modified": "2021-10-21T02:35:25",
"date_modified_gmt": "2021-10-21T02:35:25",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "21.99",
"regular_price": "21.99",
"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,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
6514,
6502,
7043,
7077,
6362
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "11"
},
"wwpp_product_wholesale_visibility_filter": [
"all"
]
}
},
{
"id": 7081,
"name": "Premium Quality 2",
"slug": "premium-quality-2",
"permalink": "https://example.com/product/premium-quality-2/",
"date_created": "2021-10-21T02:35:25",
"date_created_gmt": "2021-10-21T02:35:25",
"date_modified": "2021-10-21T02:35:25",
"date_modified_gmt": "2021-10-21T02:35:25",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "21.99",
"regular_price": "21.99",
"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,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
7047,
6502,
7072,
6460,
7073
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "122"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_ignore_cat_level_wholesale_discount": "yes",
"wwpp_ignore_role_level_wholesale_discount": "yes",
"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": 7076,
"name": "Updated Title",
"slug": "premium-quality-test-batch-1-2",
"permalink": "https://example.com/product/premium-quality-test-batch-1-2/",
"date_created": "2021-10-21T02:33:55",
"date_created_gmt": "2021-10-21T02:33:55",
"date_modified": "2021-10-21T02:35:25",
"date_modified_gmt": "2021-10-21T02:35:25",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "21.99",
"regular_price": "21.99",
"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,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
7043,
6351,
6361,
7080,
6376
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "20"
},
"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": 7079,
"name": "Updated Title 2",
"slug": "build-your-ninja-outfit-composite",
"permalink": "https://example.com/product/build-your-ninja-outfit-composite/",
"date_created": "2021-10-21T02:33:56",
"date_created_gmt": "2021-10-21T02:33:56",
"date_modified": "2021-10-21T02:35:26",
"date_modified_gmt": "2021-10-21T02:35:26",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"short_description": "In pretium enim justo, at ornare libero aliquam quis.",
"sku": "",
"price": "22",
"regular_price": "22",
"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,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>22.00</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
7078,
6372,
7076,
6361,
7043
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "66"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_ignore_cat_level_wholesale_discount": "yes",
"wwpp_ignore_role_level_wholesale_discount": "yes",
"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": 7077,
"name": "Premium Quality new1",
"slug": "premium-quality-new1-2",
"permalink": "https://example.com/product/premium-quality-new1-2/",
"date_created": "2021-10-21T02:33:56",
"date_created_gmt": "2021-10-21T02:33:56",
"date_modified": "2021-10-21T02:33:56",
"date_modified_gmt": "2021-10-21T02:33:56",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "",
"short_description": "",
"sku": "",
"price": "21.99",
"regular_price": "21.99",
"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,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
7043,
7073,
6372,
7012,
6365
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "122"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_ignore_cat_level_wholesale_discount": "yes",
"wwpp_ignore_role_level_wholesale_discount": "yes",
"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": 7078,
"name": "Happy Ninja Bundle",
"slug": "happy-ninja-bundle",
"permalink": "https://example.com/product/happy-ninja-bundle/",
"date_created": "2021-10-21T02:33:56",
"date_created_gmt": "2021-10-21T02:33:56",
"date_modified": "2021-10-21T02:33:56",
"date_modified_gmt": "2021-10-21T02:33:56",
"type": "simple",
"status": "publish",
"featured": false,
"catalog_visibility": "visible",
"description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"short_description": "In pretium enim justo, at ornare libero aliquam quis.",
"sku": "",
"price": "37.0",
"regular_price": "53.0",
"sale_price": "37.0",
"date_on_sale_from": null,
"date_on_sale_from_gmt": null,
"date_on_sale_to": null,
"date_on_sale_to_gmt": null,
"on_sale": true,
"purchasable": true,
"total_sales": 0,
"virtual": false,
"downloadable": false,
"downloads": [],
"download_limit": -1,
"download_expiry": -1,
"external_url": "",
"button_text": "",
"tax_status": "taxable",
"tax_class": "",
"manage_stock": false,
"stock_quantity": null,
"backorders": "no",
"backorders_allowed": false,
"backordered": false,
"low_stock_amount": null,
"sold_individually": false,
"weight": "",
"dimensions": {
"length": "",
"width": "",
"height": ""
},
"shipping_required": true,
"shipping_taxable": true,
"shipping_class": "",
"shipping_class_id": 0,
"reviews_allowed": true,
"average_rating": "0",
"rating_count": 0,
"upsell_ids": [],
"cross_sell_ids": [],
"parent_id": 0,
"purchase_note": "",
"tags": [],
"images": [],
"attributes": [],
"default_attributes": [],
"variations": [],
"grouped_products": [],
"menu_order": 0,
"price_html": "<del aria-hidden=\"true\"><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>53.00</bdi></span></del> <ins><span class=\"woocommerce-Price-amount amount\"><bdi><span class=\"woocommerce-Price-currencySymbol\">$</span>37.00</bdi></span></ins> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
"related_ids": [
6361,
7073,
7072,
6376,
6365
],
"stock_status": "instock",
"wholesale_data": {
"wholesale_price": {
"wholesale_customer": "22"
},
"wholesale_minimum_order_quantity": {
"wholesale_customer": "2"
},
"wholesale_order_quantity_step": {
"wholesale_customer": "6"
},
"wwpp_product_wholesale_visibility_filter": [
"wholesale_customer"
],
"wwpp_ignore_cat_level_wholesale_discount": "yes",
"wwpp_ignore_role_level_wholesale_discount": "yes",
"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"
}
]
}
}
}
]
}