Batch Update

Sample request on how to create a wholesale bundle product using batch update:

POST: /wp-json/wholesale/v1/products/batch

JSON Body:
{
    "create": [
        {
            "name": "Premium Quality",
            "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"
                }
            ]
        },
        {
            "name": "Happy Ninja Bundle",
            "type": "bundle",
            "regular_price": "53.0",
            "sale_price": "37.0",
            "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.",
            "bundle_layout": "default",
            "bundled_items": [
                {
                    "product_id": 75,
                    "quantity_min": 1,
                    "quantity_max": 1,
                    "priced_individually": true,
                    "shipped_individually": false,
                    "optional": false,
                    "override_title": true,
                    "title": "Happy Ninja T-Shirt"
                }
            ],
            "wholesale_price": {
                "wholesale_customer": "22"
            },
            "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"
                }
            ]
        }
    ],
    "update": [
        {
            "id": 7043,
            "name": "Title Updated",
            "wholesale_price": {
                "wholesale_customer": "15"
            }
        }
    ],
    "delete": [
        7024,
        7044
    ]
}

Response:

{
    "create": [
        {
            "id": 7087,
            "name": "Premium Quality",
            "slug": "premium-quality",
            "permalink": "https://example.com/product/premium-quality/",
            "date_created": "2021-10-21T06:35:39",
            "date_created_gmt": "2021-10-21T06:35:39",
            "date_modified": "2021-10-21T06:35:39",
            "date_modified_gmt": "2021-10-21T06:35:39",
            "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\">&#36;</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
            "related_ids": [
                7012,
                6503,
                6460,
                7024,
                6353
            ],
            "stock_status": "instock",
            "bundle_layout": "",
            "bundle_add_to_cart_form_location": "",
            "bundle_editable_in_cart": false,
            "bundle_sold_individually_context": "",
            "bundle_item_grouping": "",
            "bundle_min_size": "",
            "bundle_max_size": "",
            "bundled_by": [],
            "bundled_items": [],
            "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"
                        }
                    ]
                }
            }
        },
        {
            "id": 0,
            "error": {
                "code": "woocommerce_rest_invalid_bundled_product_id",
                "message": "Product ID #75 is invalid.",
                "data": {
                    "status": 400
                }
            }
        }
    ],
    "update": [
        {
            "id": 7043,
            "name": "Title Updated",
            "slug": "premium-quality-test-batch-1",
            "permalink": "https://example.com/product/premium-quality-test-batch-1/",
            "date_created": "2021-10-20T02:42:34",
            "date_created_gmt": "2021-10-20T02:42:34",
            "date_modified": "2021-10-21T06:35:40",
            "date_modified_gmt": "2021-10-21T06:35:40",
            "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\">&#36;</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
            "related_ids": [
                6376,
                7012,
                6542,
                6365,
                6372
            ],
            "stock_status": "instock",
            "bundle_layout": "",
            "bundle_add_to_cart_form_location": "",
            "bundle_editable_in_cart": false,
            "bundle_sold_individually_context": "",
            "bundle_item_grouping": "",
            "bundle_min_size": "",
            "bundle_max_size": "",
            "bundled_by": [
                "7086"
            ],
            "bundled_items": [],
            "wholesale_data": {
                "wholesale_price": {
                    "wholesale_customer": "15"
                },
                "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"
                        }
                    ]
                }
            }
        }
    ],
    "delete": [
        {
            "id": 7024,
            "name": "Product Title Updated",
            "slug": "in-stock",
            "permalink": "https://example.com/product/in-stock/",
            "date_created": "2021-10-08T02:33:48",
            "date_created_gmt": "2021-10-08T02:33:48",
            "date_modified": "2021-10-20T02:47:57",
            "date_modified_gmt": "2021-10-20T02:47:57",
            "type": "simple",
            "status": "publish",
            "featured": false,
            "catalog_visibility": "visible",
            "description": "",
            "short_description": "",
            "sku": "",
            "price": "20",
            "regular_price": "20",
            "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": true,
            "stock_quantity": 10,
            "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\">&#36;</span>20.00</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
            "related_ids": [
                6503,
                7087,
                6365,
                7047,
                6361
            ],
            "stock_status": "instock",
            "bundle_layout": "",
            "bundle_add_to_cart_form_location": "",
            "bundle_editable_in_cart": false,
            "bundle_sold_individually_context": "",
            "bundle_item_grouping": "",
            "bundle_min_size": "",
            "bundle_max_size": "",
            "bundled_by": [],
            "bundled_items": [],
            "wholesale_data": {
                "wholesale_price": {
                    "wholesale_customer": "35"
                },
                "wholesale_minimum_order_quantity": {
                    "wholesale_customer": "5"
                },
                "wholesale_order_quantity_step": {
                    "wholesale_customer": "3"
                },
                "wwpp_product_wholesale_visibility_filter": [
                    "all"
                ],
                "wwpp_ignore_cat_level_wholesale_discount": "no",
                "wwpp_ignore_role_level_wholesale_discount": "no",
                "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": 7044,
            "name": "Premium Quality new1",
            "slug": "premium-quality-new1",
            "permalink": "https://example.com/product/premium-quality-new1/",
            "date_created": "2021-10-20T02:42:34",
            "date_created_gmt": "2021-10-20T02:42:34",
            "date_modified": "2021-10-20T02:42:34",
            "date_modified_gmt": "2021-10-20T02:42:34",
            "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\">&#36;</span>21.99</bdi></span> <small class=\"woocommerce-price-suffix\">inc. VAT</small>",
            "related_ids": [
                7047,
                6353,
                6362,
                6361,
                6460
            ],
            "stock_status": "instock",
            "bundle_layout": "",
            "bundle_add_to_cart_form_location": "",
            "bundle_editable_in_cart": false,
            "bundle_sold_individually_context": "",
            "bundle_item_grouping": "",
            "bundle_min_size": "",
            "bundle_max_size": "",
            "bundled_by": [],
            "bundled_items": [],
            "wholesale_data": {
                "wholesale_price": {
                    "wholesale_customer": "122"
                },
                "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"
                        }
                    ]
                }
            }
        }
    ]
}

Last updated