atomicsolutions.dev
Menu

API Reference

Product hooks

useProducts(params?)

Fetches a list of WooCommerce products. Returns UseQueryResult<PaginatedResponse<WCProduct>>.

useProduct(id)

Fetches a single product by ID. Returns UseQueryResult<WCProduct>.

Cart hooks

useCart()

Returns the current cart state. Returns UseQueryResult<WCCart>.

useAddToCart()

Mutation: mutate({ id: number, quantity: number, variation?: object }).

useUpdateCartItem()

Mutation: mutate({ itemKey: string, quantity: number }).

useRemoveCartItem()

Mutation: mutate({ itemKey: string }).

Checkout hooks

useCheckout()

Returns checkout state (billing, shipping, payment method).

usePlaceOrder()

Mutation: places the order and returns WCOrder on success.

Order hooks

useOrders()

Fetches the authenticated user’s order history.

useOrder(id)

Fetches a single order by ID.