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 updateShippingDetails method of the CT module.
const { cart } = await sdk.ct.updateShippingDetails({
  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 updateCart method of the CT module with the setBillingAddress action.
const params = {
  cartId: 'abc123',
  cartVersion: 1,
  actions: [
    { setBillingAddress: { address: {/* address properties */} } }
  ]
};
const { cart } = await sdk.ct.updateCart(params);
Setting shipping method
To set a shipping method to the checkout, you can use the updateCart method with the setShippingMethod action.
const { cart } = await sdk.ct.updateCart({
  cartId: '6931b5d2-986f-4d2b-8cba-45007a26eb5e',
  cartVersion: 1,
  actions: [
    { setShippingMethod: { shippingMethod: { id: '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.
const { order } = await sdk.ct.createMyOrderFromCart({
  cartId: '6931b5d2-986f-4d2b-8cba-45007a26eb5e',
  cartVersion: 1
});