Alokai

getCustomerOrders

Returns a pageable list of all customer's orders.

This method communicates with the getCustomerOrders endpoint of the Vue Storefront API Middleware. In turn, it receives data from the getCustomerOrders or the Get orders of customer endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.

Signature

export declare function getCustomerOrders(
	props: GetCustomerOrdersParams
): Promise<import("commerce-sdk/dist/customer/customer").ShopperCustomers.CustomerOrderResult>;

Parameters

NameRequiredTypeDescription
propsRequiredGetCustomerOrdersParamsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.

Returns

Returns a representation of a customer's order history.

Referenced Types

  • GetCustomerOrdersParams
  • ShopperCustomers.CustomerOrderResult

Examples

Fetching the first page of 10 orders of the current customer's order history.

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

const customer = await sdk.commerce.getCustomerOrders({
  offset: 0,
  limit: 10,
});

Fetching the first page of completed orders of the current customer's order history in all sites.

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

const customer = await sdk.commerce.getCustomerOrders({
  crossSites: true,
  status: 'completed',
});

Fetching the first page of orders by the current customer for a given year.

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

const customer = await sdk.commerce.getCustomerOrders({
  from: '2022-01-01 00:00',
  to: '2022-12-31 23:59',
});

On this page