WooCommerce · Schema

BatchProductRequest

Batch request for creating, updating, and deleting products.

eCommerceOpen SourceOrdersProductsWordPress

Properties

Name Type Description
create array Array of product objects to create.
update array Array of product objects with IDs to update.
delete array Array of product IDs to delete.
View JSON Schema on GitHub

JSON Schema

woocommerce-rest-api-batch-product-request-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/woocommerce/refs/heads/main/json-schema/woocommerce-rest-api-batch-product-request-schema.json",
  "title": "BatchProductRequest",
  "description": "Batch request for creating, updating, and deleting products.",
  "type": "object",
  "properties": {
    "create": {
      "type": "array",
      "description": "Array of product objects to create.",
      "items": {
        "type": "object",
        "description": "Input payload for creating or updating a product.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Product name.",
            "example": "Example Name"
          },
          "type": {
            "type": "string",
            "description": "Product type.",
            "enum": [
              "simple",
              "grouped",
              "external",
              "variable"
            ],
            "example": "simple"
          },
          "status": {
            "type": "string",
            "description": "Product publication status.",
            "enum": [
              "draft",
              "pending",
              "private",
              "publish"
            ],
            "example": "draft"
          },
          "featured": {
            "type": "boolean",
            "description": "Whether the product is featured.",
            "example": true
          },
          "description": {
            "type": "string",
            "description": "Full product description.",
            "example": "A sample description"
          },
          "short_description": {
            "type": "string",
            "description": "Short product description.",
            "example": "A sample description"
          },
          "sku": {
            "type": "string",
            "description": "Stock-keeping unit identifier.",
            "example": "string-value"
          },
          "regular_price": {
            "type": "string",
            "description": "Regular price as a decimal string.",
            "example": "string-value"
          },
          "sale_price": {
            "type": "string",
            "description": "Sale price as a decimal string.",
            "example": "string-value"
          },
          "virtual": {
            "type": "boolean",
            "description": "Whether the product is virtual.",
            "example": true
          },
          "downloadable": {
            "type": "boolean",
            "description": "Whether the product is downloadable.",
            "example": true
          },
          "manage_stock": {
            "type": "boolean",
            "description": "Whether to enable stock management.",
            "example": true
          },
          "stock_quantity": {
            "type": "integer",
            "description": "Stock quantity.",
            "example": 1
          },
          "stock_status": {
            "type": "string",
            "description": "Stock status.",
            "enum": [
              "instock",
              "outofstock",
              "onbackorder"
            ],
            "example": "instock"
          },
          "weight": {
            "type": "string",
            "description": "Product weight.",
            "example": "string-value"
          },
          "categories": {
            "type": "array",
            "description": "Categories to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "Category ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "tags": {
            "type": "array",
            "description": "Tags to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "Tag ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "images": {
            "type": "array",
            "description": "Images to attach.",
            "items": {
              "$ref": "#/components/schemas/ProductImage"
            },
            "example": [
              "string-value"
            ]
          },
          "attributes": {
            "type": "array",
            "description": "Product attributes.",
            "items": {
              "$ref": "#/components/schemas/ProductAttribute"
            },
            "example": [
              "string-value"
            ]
          },
          "meta_data": {
            "type": "array",
            "description": "Custom metadata.",
            "items": {
              "$ref": "#/components/schemas/MetaData"
            },
            "example": [
              "string-value"
            ]
          }
        }
      },
      "example": [
        "string-value"
      ]
    },
    "update": {
      "type": "array",
      "description": "Array of product objects with IDs to update.",
      "items": {
        "type": "object",
        "description": "Input payload for creating or updating a product.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Product name.",
            "example": "Example Name"
          },
          "type": {
            "type": "string",
            "description": "Product type.",
            "enum": [
              "simple",
              "grouped",
              "external",
              "variable"
            ],
            "example": "simple"
          },
          "status": {
            "type": "string",
            "description": "Product publication status.",
            "enum": [
              "draft",
              "pending",
              "private",
              "publish"
            ],
            "example": "draft"
          },
          "featured": {
            "type": "boolean",
            "description": "Whether the product is featured.",
            "example": true
          },
          "description": {
            "type": "string",
            "description": "Full product description.",
            "example": "A sample description"
          },
          "short_description": {
            "type": "string",
            "description": "Short product description.",
            "example": "A sample description"
          },
          "sku": {
            "type": "string",
            "description": "Stock-keeping unit identifier.",
            "example": "string-value"
          },
          "regular_price": {
            "type": "string",
            "description": "Regular price as a decimal string.",
            "example": "string-value"
          },
          "sale_price": {
            "type": "string",
            "description": "Sale price as a decimal string.",
            "example": "string-value"
          },
          "virtual": {
            "type": "boolean",
            "description": "Whether the product is virtual.",
            "example": true
          },
          "downloadable": {
            "type": "boolean",
            "description": "Whether the product is downloadable.",
            "example": true
          },
          "manage_stock": {
            "type": "boolean",
            "description": "Whether to enable stock management.",
            "example": true
          },
          "stock_quantity": {
            "type": "integer",
            "description": "Stock quantity.",
            "example": 1
          },
          "stock_status": {
            "type": "string",
            "description": "Stock status.",
            "enum": [
              "instock",
              "outofstock",
              "onbackorder"
            ],
            "example": "instock"
          },
          "weight": {
            "type": "string",
            "description": "Product weight.",
            "example": "string-value"
          },
          "categories": {
            "type": "array",
            "description": "Categories to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "Category ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "tags": {
            "type": "array",
            "description": "Tags to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "Tag ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "images": {
            "type": "array",
            "description": "Images to attach.",
            "items": {
              "$ref": "#/components/schemas/ProductImage"
            },
            "example": [
              "string-value"
            ]
          },
          "attributes": {
            "type": "array",
            "description": "Product attributes.",
            "items": {
              "$ref": "#/components/schemas/ProductAttribute"
            },
            "example": [
              "string-value"
            ]
          },
          "meta_data": {
            "type": "array",
            "description": "Custom metadata.",
            "items": {
              "$ref": "#/components/schemas/MetaData"
            },
            "example": [
              "string-value"
            ]
          }
        }
      },
      "example": [
        "string-value"
      ]
    },
    "delete": {
      "type": "array",
      "description": "Array of product IDs to delete.",
      "items": {
        "type": "integer"
      },
      "example": [
        1
      ]
    }
  }
}