woo_client library

A WooCommerce client for Dart: the admin REST API and the public Store API.

Two APIs, two clients, and the one you want depends on who is looking.

WooStore speaks the Store API — public, no keys, cart and checkout. This is what a shopper's app should use.

final store = WooStore(baseUrl: 'https://your-store.com');

await store.cart.addItem(id: 799, quantity: 2);
final cart = await store.cart.get();
print(cart.totals.totalPrice); // $82.56

WooCommerce speaks the admin REST API — everything, behind a key. This belongs on a server you control.

final woo = WooCommerce(
  baseUrl: 'https://your-store.com',
  credentials: const WooCredentials.key(
    consumerKey: 'ck_…',
    consumerSecret: 'cs_…',
  ),
);

final page = await woo.products.list(perPage: 20, onSale: true);

Not affiliated with or endorsed by Automattic. WooCommerce is their trademark; this is an independent client for their public APIs.

Classes

BasicCredentials
A username and password, sent as HTTP Basic.
BearerCredentials
A bearer token.
CartSession
Holds the tokens that identify one shopper's cart.
CartTokenStore
Where a cart token is kept between requests, and between app launches.
InMemoryCartTokenStore
Keeps the token for as long as the process lives.
KeyCredentials
Consumer key and secret.
NoCredentials
Nothing.
StoreAddress
A shopper's address, as the Store API represents it.
StoreAttribute
One attribute of a product, with the values it can take.
StoreBatchRequest
One call inside a WooStore.batch.
StoreCart
A shopper's cart.
StoreCartCoupon
A coupon that is currently applied to a cart.
StoreCartError
A problem the store reported about the cart itself.
StoreCartItem
One line of a cart.
StoreCartResource
The shopper's cart.
StoreCartTotals
What a cart adds up to.
StoreCheckout
A checkout: the draft order made from a cart, and the result of paying.
StoreCheckoutResource
Turning a cart into a paid order.
StoreCurrency
How a store writes its prices.
StoreDimensions
A product's size, as the store records it.
StoreImage
A picture the store attached to a product.
StoreMoney
An amount of money from the Store API.
StorePaymentResult
The outcome of a payment attempt.
StorePriceRange
The range a variable product's price falls in.
StoreProduct
A product, as the public Store API describes it.
StoreProducts
Public product browsing, with no API keys.
StoreQuantityLimits
How many of an item a shopper is allowed to have.
StoreShippingPackage
A group of cart items that ship together, with the rates available to it.
StoreShippingRate
One way of shipping one package.
StoreTerm
A category, tag, or brand attached to a product.
StoreVariation
A variation of a variable product, as listed on its parent.
WooAddress
A postal address on an order.
WooAdminResources
Everything else the admin API exposes, grouped.
WooAttribute
A global product attribute, such as Colour or Size.
WooAttributeTerm
One value an attribute can take.
WooBatchResult<T>
What a batch call did.
WooCategory
A product category.
WooCollection<T>
The shape every WooCommerce collection shares.
WooCommerce
A connection to one WooCommerce store.
WooCoupon
A discount code.
WooCoupons
Coupons and the queries over them.
WooCredentials
How to prove to the store who you are.
WooCustomer
A customer account in the store.
WooCustomers
Customers and the queries over them.
WooData
Reference data WooCommerce publishes: countries, currencies, continents.
WooImage
An image attached to a product.
WooLineItem
One line on an order.
WooOrder
An order in the store.
WooOrderNote
A note attached to an order.
WooOrders
Orders and the queries over them.
WooPage<T>
One page of a list response, with the totals WooCommerce reports alongside.
WooPaymentGateway
A payment gateway the store has configured.
WooPrice
A price, kept as the store sent it.
WooProduct
A product in the store.
WooProducts
Products, variations and the queries over them.
WooRefund
Money given back on an order.
WooReports
Sales figures, as WooCommerce computes them.
WooRetry
When to try a failed request again.
WooReview
A customer's review of a product.
WooSettings
The store's own settings.
WooShippingClass
A shipping class, which lets rates differ per product group.
WooShippingZones
Shipping zones and what they cost.
WooStore
A client for the WooCommerce Store API — the public one.
WooTag
A product tag.
WooTaxRate
A tax rate.
WooTerm
A category or tag a product belongs to.
WooWebhook
A webhook the store will call.
WooWebhookDelivery
A webhook delivery from a WooCommerce store.

Enums

StorePaymentStatus
What happened when the store tried to take payment.
StoreProductOrderBy
How to order a public product listing.
WooDiscountType
How a coupon reduces the total.
WooOrderStatus
Where an order is in its life.
WooProductOrderBy
How to sort a product listing.
WooProductType
Whether a product is on sale, and how it is sold.
WooStockStatus
Whether the store will sell it right now.

Exceptions / Errors

WooAuthException
The store rejected the credentials, or they are missing a permission.
WooBadResponseException
The store answered with something that is not the JSON this client expects.
WooException
Base class for everything this client throws.
WooInvalidRequestException
The store understood the request and refused it — a missing required field, an invalid value, a duplicate SKU.
WooNetworkException
The request never got an answer — no network, DNS failure, timeout.
WooNotFoundException
The thing asked for is not there.
WooRateLimitException
The store is refusing requests because too many arrived too quickly.
WooServerException
The store is there but broke while answering.
WooTotalMismatchException
The shopper confirmed a total the store no longer agrees with.