WooCommerce · JSON Structure

Woocommerce Rest Api Batch Product Request Structure

Batch request for creating, updating, and deleting products.

Type: object Properties: 3
eCommerceOpen SourceOrdersProductsWordPress

BatchProductRequest is a JSON Structure definition published by WooCommerce, describing 3 properties. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

create update delete

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/woocommerce/refs/heads/main/json-structure/woocommerce-rest-api-batch-product-request-structure.json",
  "name": "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": "int32",
            "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": "int32",
                  "description": "Category ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "tags": {
            "type": "array",
            "description": "Tags to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "int32",
                  "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": "int32",
            "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": "int32",
                  "description": "Category ID."
                }
              }
            },
            "example": [
              {
                "id": 1
              }
            ]
          },
          "tags": {
            "type": "array",
            "description": "Tags to assign to the product.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "int32",
                  "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": "int32"
      },
      "example": [
        1
      ]
    }
  }
}