Skip to main content

Store API Overview

The WooCommerce Store API provides public REST API endpoints for building customer-facing cart, checkout, and product functionality. It follows many of the patterns used in the WordPress REST API and is specifically designed for unauthenticated, client-side interactions.

What is the Store API?

The Store API is an unauthenticated REST API that allows developers to build modern, headless e-commerce experiences with WooCommerce. Unlike the WooCommerce REST API (which requires authentication), the Store API is designed to be called directly from frontend applications without exposing sensitive store data or customer information.
The Store API is read-only for most operations and only allows modifications to the current user’s cart and checkout session. It cannot be used to access other customers’ data or modify store settings.

Key Features

Unauthenticated Access

The Store API does not require API keys or authentication tokens for most endpoints. This makes it ideal for:
  • Single Page Applications (SPAs)
  • Progressive Web Apps (PWAs)
  • Headless commerce implementations
  • Mobile applications
  • Custom storefronts

Session-Based Cart Management

Customer sessions in WooCommerce are cookie-based by default, but the Store API also supports headless implementations using Cart Tokens for session management without cookies.

Modern REST Patterns

  • JSON-formatted responses
  • Well-defined schemas
  • Predictable error handling
  • Standard HTTP status codes
  • Pagination for large datasets

Use Cases

The Store API is designed for building customer-facing commerce experiences:
  1. Product Discovery - Obtain filtered and searchable product lists with rich metadata
  2. Cart Management - Add products to cart, update quantities, apply coupons, and calculate shipping
  3. Checkout Flow - Collect customer addresses, select shipping methods, and process payments
  4. Order Completion - Convert carts to orders and handle payment processing

API Namespace

All Store API resources are found within the wc/store/v1 namespace. Since this API extends the WordPress API, accessing it requires the /wp-json/ base.
Currently, v1 is the only available version. If the version is omitted from the URL, v1 will be served by default.

Quick Start

Here’s a simple example of fetching products from the Store API:
Response

Available Endpoints

The Store API provides endpoints for all major e-commerce operations:

Authentication & Security

Nonce Tokens

While most GET requests don’t require authentication, operations that modify data (POST, PUT, DELETE) require a Nonce Token for security:
Nonces are generated using WordPress’s wp_create_nonce() function:
After each request, an updated Nonce header is returned in the response. Your application must store and use this updated nonce for subsequent requests.

Cart Tokens

For headless implementations without cookies, use Cart Tokens instead of nonces:
Cart Tokens are returned in the Cart-Token response header when making cart requests. Learn more in the Cart API documentation.

Requirements and Limitations

The Store API is designed for customer-facing operations only. It has important security limitations:
  • Unauthenticated access - No API keys or OAuth required
  • Current user only - Can only access data for the current session/user
  • No admin operations - Cannot modify store settings or access admin data
  • Cookie-based sessions - Uses WordPress cookies by default (Cart Tokens available for headless)
  • Nonce required - Write operations require valid nonce tokens or cart tokens
For administrative operations or accessing other customers’ data, use the authenticated WooCommerce REST API.

Pagination

Endpoints that return collections support pagination parameters:
Pagination information is returned in response headers:

HTTP Status Codes

The Store API uses standard HTTP status codes:

Error Handling

Error responses follow a consistent format:
For conflict errors (409), the response includes the current cart state:
This allows your application to stay synchronized with the server state without additional requests.

Headless Commerce

The Store API is ideal for building headless commerce applications:

Benefits

  • Framework agnostic - Use with React, Vue, Angular, or any JavaScript framework
  • Mobile-friendly - Perfect for iOS, Android, and cross-platform mobile apps
  • Performance - Client-side rendering with API-driven data
  • Flexibility - Complete control over UI/UX

Example: React + Store API

Cart Token Authentication

For serverless or headless setups, use Cart Tokens instead of cookies:

Extensibility

The Store API can be extended by plugin developers:

Adding Custom Fields

Custom Routes

For entirely new endpoints, use WordPress’s register_rest_route():

Next Steps

Cart API

Learn how to manage cart operations, add items, and apply coupons

Checkout API

Understand the checkout flow and payment processing

REST API Reference

Explore the authenticated WooCommerce REST API for admin operations

WordPress REST API

Learn about the underlying WordPress REST API

Additional Resources