Wholesale Suite API
  • REST API
  • wholesale/v1 (Free)
    • Products
      • List All Wholesale Products
      • Retrieve a Wholesale Product
      • Create a Wholesale Product
      • Update a Wholesale Product
      • Delete a Wholesale Product
      • Batch Update Products
    • Variations
      • List All Wholesale Variations
      • Retrieve a Wholesale Variation
      • Create a Wholesale Variation
      • Update a Wholesale Variation
      • Delete a Wholesale Variation
      • Batch Update Variations
    • Wholesale Role
      • List Wholesale Roles
      • Retrieve a Wholesale Role
      • Update a Wholesale Role
  • wholesale/v1 (Premium)
    • Products
      • List All Wholesale Products
      • Retrieve a Wholesale Product
      • Create a Wholesale Product
      • Update a Wholesale Product
      • Delete a Wholesale Product
      • Batch Update Products
    • Variations
      • List All Wholesale Variations
      • Retrieve a Wholesale Variation
      • Create a Wholesale Variation
      • Update a Wholesale Variation
      • Delete a Wholesale Variation
      • Batch Update Variations
    • Wholesale Role
      • List Wholesale Roles
      • Retrieve a Wholesale Role
      • Create a Wholesale Role
      • Update a Wholesale Role
      • Delete a Wholesale Role
    • Category Discounts
      • List Category Discounts
      • Retrieve Category Discount
      • Create Category Discount
      • Update Category Discount
      • Delete Category Discount
    • General Discounts
      • List General Discounts
      • Retrieve Specific Role Discount
      • Create a General Discount
      • Update a general Discount
      • Delete a General Discount
    • Bundle
      • Create Bundle Product
      • Batch Update
    • Composite
      • Create Composite Product
      • Batch Update
Powered by GitBook
On this page

Was this helpful?

  1. wholesale/v1 (Free)
  2. Variations

Batch Update Variations

This API handles batch create, update and delete a wholesale or non-wholesale variations.

Method

Endpoint

POST

/wp-json/wholesale/v1/products/{variable_id}/batch

Postman

Batch update variations.

POST: /wp-json/wholesale/v1/products/{variation_id}/batch

JSON Body:
{
    "create" : [
        {
            "regular_price" : "29.00",
            "attributes": [
                {
                    "id": 1,
                    "name": "Color",
                    "option": "Black"
                }
            ]
        }
    ],
    "update": [
        {
            "id": {product_id},
            "wholesale_price" : { 
                "wholesale_customer" : "16"
            }
        }
    ],
    "delete" : [{product_ids}]
}

Status: 200 OK

Batch update variations.

POST: /wp-json/wholesale/v1/products/{variation_id}/batch

JSON Body:
{
    "create" : [
        {
            "regular_price" : "29.00",
            "attributes": [
                {
                    "id": 1,
                    "name": "Color",
                    "option": "Black"
                }
            ]
        }
    ],
    "update": [
        {
            "id": {product_id},
            "wholesale_price" : { 
                "wholesale_customer" : "16"
            }
        }
    ],
    "delete" : [{product_ids}]
}

Response:
{
    "create": [
        {
            "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": "http://localhost/new/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": []
        }
    ],
    "update": [
        {
            "id": 7049,
            "date_created": "2021-10-20T03:46:17",
            "date_created_gmt": "2021-10-20T03:46:17",
            "date_modified": "2021-10-20T13:03:36",
            "date_modified_gmt": "2021-10-20T13:03:36",
            "description": "",
            "permalink": "http://localhost/new/product/variable-test/?attribute_pa_color=green",
            "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,
            "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": "Green"
                }
            ],
            "menu_order": 2,
            "wholesale_data": {
                "wholesale_price": {
                    "wholesale_customer": "16"
                }
            }
        }
    ],
    "delete": [
        {
            "id": 7069,
            "date_created": "2021-10-20T05:43:12",
            "date_created_gmt": "2021-10-20T05:43:12",
            "date_modified": "2021-10-20T05:43:12",
            "date_modified_gmt": "2021-10-20T05:43:12",
            "description": "",
            "permalink": "http://localhost/new/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": []
        }
    ]
}
PreviousDelete a Wholesale VariationNextWholesale Role

Last updated 3 years ago

Was this helpful?