Vue Storefront is now Alokai! Learn More
Cart

Cart

Introduction

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 address

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 address

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 method

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 cart

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
});