WooCommerce · Schema

CartShippingRate

A shipping rate option available for the cart.

eCommerceOpen SourceOrdersProductsWordPress

Properties

Name Type Description
package_id integer Shipping package index.
name string Shipping package name.
destination object Shipping destination address.
items array Cart items in this shipping package.
shipping_rates array Available shipping rates for this package.
View JSON Schema on GitHub

JSON Schema

woocommerce-store-api-cart-shipping-rate-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-store-api-cart-shipping-rate-schema.json",
  "title": "CartShippingRate",
  "description": "A shipping rate option available for the cart.",
  "type": "object",
  "properties": {
    "package_id": {
      "type": "integer",
      "description": "Shipping package index.",
      "example": 1
    },
    "name": {
      "type": "string",
      "description": "Shipping package name.",
      "example": "Example Name"
    },
    "destination": {
      "type": "object",
      "description": "Shipping destination address.",
      "properties": {
        "address_1": {
          "type": "string",
          "description": "Address line 1."
        },
        "address_2": {
          "type": "string",
          "description": "Address line 2."
        },
        "city": {
          "type": "string",
          "description": "City."
        },
        "state": {
          "type": "string",
          "description": "State code."
        },
        "postcode": {
          "type": "string",
          "description": "Postcode."
        },
        "country": {
          "type": "string",
          "description": "Country code."
        }
      },
      "example": {
        "address_1": "string-value",
        "address_2": "string-value",
        "city": "string-value",
        "state": "string-value",
        "postcode": "string-value",
        "country": "string-value"
      }
    },
    "items": {
      "type": "array",
      "description": "Cart items in this shipping package.",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Cart item key."
          },
          "name": {
            "type": "string",
            "description": "Product name."
          },
          "quantity": {
            "type": "integer",
            "description": "Item quantity."
          }
        }
      },
      "example": [
        {
          "key": "string-value",
          "name": "Example Name",
          "quantity": 1
        }
      ]
    },
    "shipping_rates": {
      "type": "array",
      "description": "Available shipping rates for this package.",
      "items": {
        "type": "object",
        "properties": {
          "rate_id": {
            "type": "string",
            "description": "Shipping rate unique ID."
          },
          "name": {
            "type": "string",
            "description": "Shipping rate display name."
          },
          "description": {
            "type": "string",
            "description": "Shipping rate description."
          },
          "price": {
            "type": "string",
            "description": "Shipping cost as a decimal string."
          },
          "taxes": {
            "type": "string",
            "description": "Shipping tax as a decimal string."
          },
          "selected": {
            "type": "boolean",
            "description": "Whether this rate is currently selected."
          },
          "meta_data": {
            "type": "array",
            "description": "Additional rate metadata.",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "example": [
        {
          "rate_id": "500123",
          "name": "Example Name",
          "description": "A sample description",
          "price": "string-value",
          "taxes": "string-value",
          "selected": true,
          "meta_data": [
            {}
          ]
        }
      ]
    }
  }
}