The useUserCarts() composable method allows for fetching and storing a list of the current user carts (both active and saved). Contrary to other cart-related composables, it does not accept a unique id as a parameter and only has a single instance.


Main data object populated by the load() method.


const carts: ComputedProperty<Cart[]>

References: Cart


Indicates whether any of the composable methods is in progress.


const loading: ComputedProperty<UseUserCartsLoading>;

References: UseUserCartsLoading


Contains errors thrown by any of the composable methods.


const error: ComputedRef<UseUserCartsError>;

References: UseUserCartsError


Fetches user carts and populates the carts property. Under the hood, it sends a request to the getCarts API endpoint.

Remember to log in first!

This method will not work when used during an anonymous session.


interface LoadUserCartsProps extends BaseProps {
  savedCartsOnly?: boolean;
  pageSize?: number;
  currentPage?: number;
  sort?: string

async function load: (props?: LoadUserCartsProps) => Promise<void>

References: LoadUserCartsProps, BaseProps


In the following example we are fetching a list of user's saved carts only (skipping the active cart), limit the number of returned Cart entries to five and select the BASIC subset of fields.

import { onMounted } from '@nuxtjs/composition-api';
import { useUserCarts } from '@vsf-enterprise/sapcc';

export default {
  setup() {
    const { carts, load: loadUserCarts } = useUserCarts();

    onMounted(async () => {
      await loadUserCarts({
        savedCartsOnly: true,
        pageSize: 5,
        fields: 'BASIC'

    return { carts };