Skip to main content

Function: fetchActiveCart()

fetchActiveCart(cfg): Promise<Cart | null>

Defined in: composables/shared/utils/fetchActiveCart.ts:51

Fetches the user's existing OPEN cart, or null when none exists.

Parameters

cfg

FetchActiveCartConfig

The fetch configuration.

Returns

Promise<Cart | null>

The hydrated open cart, or null if none is found or the lookup fails.

Remarks

Uses the Services.cart SDK service:

  • cart.getCarts searches OPEN carts filtered by contact/customer/company.
  • cart.getCart hydrates the most recent matching cart by cartId. Errors are caught, logged, and surfaced as a null return.