createOrder
Method fetching information about a specific category from Salesforce Commerce Cloud.
This method communicates with the createOrder endpoint of the Vue Storefront API Middleware. In turn, it receives data from the createOrder or the Submit basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
You can use this method to fetch information about a category available in the storefront catalog assigned to the current site.
Signature
export declare function createOrder(
props: OrderCreateParams
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperOrders.Order>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | OrderCreateParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Category Hierarchy.
Referenced Types
OrderCreateParamsShopperOrders.Order
Examples
Fetching a category by id.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.createOrder({ id: 'root' });Fetching a category by id and changing the levels of nested subcategories through levels.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.createOrder({ id: 'root', levels: 2 });Fetching a category by id for a different than the currently active locale.
import { sdk } from '~/sdk.config.ts';
const category = await sdk.commerce.createOrder({ id: 'root', locale: 'en_US' });