Vue Storefront is now Alokai! Learn More
Cart

Cart

Introductionri:link

This section will cover the basics of the checkout and how to use it.

API Reference

You can find all available CT module methods and their description in the API Reference.

Setting a shipping addressri:link

To add a shipping address to the checkout, you can use the setCartShippingAddress method of the CT module.

import { sdk } from '~/sdk.config.ts';

const { cart } = await sdk.ct.setCartShippingAddress({
  cartId: '6931b5d2-986f-4d2b-8cba-45007a26eb5e',
  cartVersion: 1,
  address: {
    firstName: 'John',
    lastName: 'Doe',
    streetName: 'Street Name',
    city: 'Berlin',
    country: 'DE'
  }
});

Setting a billing addressri:link

To add a billing address to the checkout, you can use the setCartBillingAddress method of the CT module.

import { sdk } from '~/sdk.config.ts';

const params = {
  cartId: 'abc123',
  cartVersion: 1,
  address: {
    // address properties
  }
};

const { cart } = await sdk.ct.setCartBillingAddress(params);

Setting shipping methodri:link

To set a shipping method to the checkout, you can use the setShippingMethod method of the CT module.

import { sdk } from '~/sdk.config.ts';

const { cart } = await sdk.ct.setShippingMethod({
  cartId: '6931b5d2-986f-4d2b-8cba-45007a26eb5e',
  cartVersion: 1,
  shippingMethodId: '7015a612-a16b-47ab-9672-bc72fcfb129a'
});

Creating an order from cartri:link

To create an order from the cart, you can use the createMyOrderFromCart method of the CT module.

import { sdk } from '~/sdk.config.ts';

const { order } = await sdk.ct.createMyOrderFromCart({
  cartId: '6931b5d2-986f-4d2b-8cba-45007a26eb5e',
  cartVersion: 1
});