WooCommerce · Schema

ProductVariation

A variation of a variable product with its own pricing and stock.

eCommerceOpen SourceOrdersProductsWordPress

Properties

Name Type Description
id integer Variation unique identifier.
sku string Stock-keeping unit for this variation.
price string Current price as a decimal string.
regular_price string Regular price as a decimal string.
sale_price string Sale price as a decimal string.
on_sale boolean Whether the variation is on sale.
status string Variation status.
manage_stock boolean Whether stock is managed for this variation.
stock_quantity integer Stock quantity for this variation.
stock_status string Stock status.
image object An image associated with a product.
attributes array Specific attribute values that define this variation.
meta_data array Custom metadata for this variation.
View JSON Schema on GitHub

JSON Schema

woocommerce-rest-api-product-variation-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-product-variation-schema.json",
  "title": "ProductVariation",
  "description": "A variation of a variable product with its own pricing and stock.",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "description": "Variation unique identifier.",
      "example": 1
    },
    "sku": {
      "type": "string",
      "description": "Stock-keeping unit for this variation.",
      "example": "string-value"
    },
    "price": {
      "type": "string",
      "description": "Current price as a decimal string.",
      "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"
    },
    "on_sale": {
      "type": "boolean",
      "description": "Whether the variation is on sale.",
      "example": true
    },
    "status": {
      "type": "string",
      "description": "Variation status.",
      "enum": [
        "draft",
        "pending",
        "private",
        "publish"
      ],
      "example": "draft"
    },
    "manage_stock": {
      "type": "boolean",
      "description": "Whether stock is managed for this variation.",
      "example": true
    },
    "stock_quantity": {
      "type": "integer",
      "description": "Stock quantity for this variation.",
      "nullable": true,
      "example": 1
    },
    "stock_status": {
      "type": "string",
      "description": "Stock status.",
      "enum": [
        "instock",
        "outofstock",
        "onbackorder"
      ],
      "example": "instock"
    },
    "image": {
      "type": "object",
      "description": "An image associated with a product.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "Image unique identifier.",
          "example": 1
        },
        "src": {
          "type": "string",
          "format": "uri",
          "description": "Image URL.",
          "example": "https://example.com/path"
        },
        "name": {
          "type": "string",
          "description": "Image name.",
          "example": "Example Name"
        },
        "alt": {
          "type": "string",
          "description": "Image alternative text.",
          "example": "string-value"
        }
      }
    },
    "attributes": {
      "type": "array",
      "description": "Specific attribute values that define this variation.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Attribute ID."
          },
          "name": {
            "type": "string",
            "description": "Attribute name."
          },
          "option": {
            "type": "string",
            "description": "Selected option value for this variation."
          }
        }
      },
      "example": [
        {
          "id": 1,
          "name": "Example Name",
          "option": "string-value"
        }
      ]
    },
    "meta_data": {
      "type": "array",
      "description": "Custom metadata for this variation.",
      "items": {
        "type": "object",
        "description": "Custom metadata key-value entry.",
        "properties": {
          "id": {
            "type": "integer",
            "description": "Metadata unique identifier.",
            "example": 1
          },
          "key": {
            "type": "string",
            "description": "Metadata key.",
            "example": "string-value"
          },
          "value": {
            "type": "string",
            "description": "Metadata value.",
            "example": "string-value"
          }
        }
      },
      "example": [
        "string-value"
      ]
    }
  }
}