Vue Storefront is now Alokai! Learn More
Users

Users

Introductionri:link

This section will cover the basics of fetching the user details, managing user addresses and changing the user password.

API Reference

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

Get meri:link

To get the user details, you can use the getMe method of the CT module.

Fetching basic user profile (i.e. cart).

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

const { me } = await sdk.ct.getMe();

Fetching full user profile (i.e. cart and customer profile).

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

const { me } = await sdk.ct.getMe({ customer: true });

Updating the user profileri:link

To update the user profile, you can use the updateCustomer method of the CT module.

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

const { user } = await sdk.ct.updateCustomer({
  version: 123,
  actions: [
    { setFirstName: { firstName: 'John' } },
    { setLastName: { lastName: 'Doe' } },
    { setMiddleName: { middleName: 'Donald' } },
    { setSalutation: { salutation: 'Hello' } },
    { setTitle: { title: 'Mr' } },
    { setVatId: { vatId: '6514161212' }},
    { setCompanyName: { companyName: 'Alokai' } },
    { setDateOfBirth: { dateOfBirth: '2015-10-21' } },
    { setLocale: { locale: 'de' } }
  ]
});