You are viewing API docs for version 1.89.3.

View latest

Home > widget-integration > CartService > getCartItems

CartService.getCartItems() method

Get all items currently in the cart Returns empty array if cart is empty or on error

Signature:

getCartItems(): Promise<unknown[]>;

Returns:

Promise<unknown[]>

Promise resolving to array of cart items from Shopify (empty array on error)

Example

const items = await cartService.getCartItems();
console.log(`Cart has ${items.length} items`);