Storefront APIs

B2B and D2C stores built with LWR templates support Storefront APIs that help you build custom Lightning Web Components (LWCs) including headers, footers, and banners. Storefront APIs connect LWCs with data and execute processes, like adding a product to a wishlist or a cart, or applying a coupon to an order. Storefront APIs simplify LWC creation and help integrate components into larger page contexts.

Required Editions
Available in: Lightning communities accessed through Lightning Experience in Enterprise, Unlimited, and Developer editions.

Implementing components with Storefront APIs delivers distinct advantages over those relying on platform UI APIs and Aura controllers:

  • Security - Storefront APIs automatically apply guardrails, such as buyer entitlement, that protect transactions and personalize customer journeys, with minimum risk.
  • Performance and Scalability - Storefront APIs ensure that the same data is not requested and retrieved multiple times. Optimized to use multiple cache layers (browser, CDN, server), Storefront APIs retrieve information efficiently. Storefront Actions, for example, are designed to fetch data from the nearest available source.
  • Convenience - Storefront APIs aggregate data from multiple sources and objects, like catalogs, or price books, and can execute business logic (fetch a product price, determine promotion eligibility).
  • UI Cohesiveness - Components that implement Storefront APIs help ensure a consistent, cohesive customer experience. Cart components that use Wire Adapters, for example, achieve real-time reactivity: adding an item to a cart automatically updates the cart icon in the header.

The Storefront APIs fetch and display data for Commerce, Platform, and CMS products and include Imperative APIs, Wire Adapters, and Storefront Actions. Each of these differ in how and when they retrieve data for your component. A State Management layer provides access to hosted data via REST APIs and also coordinates operations that engage and update builder components. For example, when a buyer adds a product to the cart via a Storefront API, the State Management layer assures that this updates the list of cart items and the cart status icon. Taken together, the Storefront APIs provide a comprehensive framework for a dynamic shopping experience.

Illustration of Custom Component Apis.

  • Imperative APIs are process-oriented functions that, for example, call a Connect API method (POST, PUT, PATCH) to update data and return an outcome. Imperative calls typically retrieve hosted data when triggered by a page load or button click. Imperative APIs prompt updates to related entities including Wire Adapters, all orchestrated via State Management.
  • Wire Adapters specify a GET method to call and retrieve data from a hosted data source. The adapter automatically updates properties in the LWC when hosted source data changes. When the LWC loads or updates, it executes the adapter call and retrieves the data in real time. For more information, see Understand the Wire Service.
  • Storefront Actions are events, such as adding an item to a cart or using a filter to search on a product variant, that trigger updates to closely-related LWCs. Unlike actual backend API endpoint communication, Storefront Actions react to UI clicks more responsively, by making changes to related page-level components in chain-of-sequence fashion within a proximate scope. When a customer clicks a quantity selector component, for example, a createCartItemsLoadAction refreshes the quantity displayed in the cart. Tight data binding ensures that the triggered operation gets and sets data from the closest source. That said, Storefront Actions can result in calls (via Wire Adapters or Imperative APIs) to Rest API endpoints

These tables provide information about custom component Imperative APIs and adapters.

In B2B and D2C stores, imperative Checkout APIs intentionally strip any 'name' properties on ContactPointAddress, CartDeliveryGroup, and OrderDeliveryGroup objects before initiating the request to Checkout Connect Endpoints. The best way to work around this issue is to create custom Apex triggers on insert or update for the relevant objects to update DeliverToName based on your stores globalization requirements. We recommend using the same behavior as the out of the box checkout component and only pass ContactPointAddress ID when calling the updateShippingAddress Imperative API.

Namespace/BundleName/InterfaceProductAPI VersionDescriptionAssociated Endpoint
commerce/activitiesApitrackAddProductToCart(product: Product): voidCommerce55.0Triggers the addToCart activity when a shopper adds a product to the cart.

If you replace the Product Detail Purchase Options component with a custom component, implement the addToCart activity to ensure that Commerce Einstein Recommendations use cases generate results based on shopper or buyer view behavior.

Einstein Recommendations API
commerce/activitiesApitrackClickReco(recommenderName: string,\\The name of the recommender recoUUID: string,\\A string representing the unique ID for this recommendation response product: Product,\\An object with an 18-character product ID that represents the product that the customer clicked sku: string});\\(Optional) A unique stock keeping unit identifier for the product ): voidCommerce55.0Triggers the clickReco activity when a recommended product is clicked and the customer is taken to the product detail page.

Implement this activity when building a custom Commerce Einstein recommendations component.

Einstein Recommendations API
commerce/activitiesApitrackViewProduct({ id: productId,\\The 18-character productId of the product that the customer viewed sku: string});\\(Optional) A unique stock keeping unit identifier for the productCommerce55.0Triggers the viewProduct activity when a shopper views a Product Detail page.

Don’t fire if a product is displayed via a recommendation, search result, or any other means.

If you replace the Product Detail Purchase Options component with a custom component, implement the viewProduct activity to ensure that Commerce Einstein Recommendations use cases generate results based on shopper or buyer view behavior.

Einstein Recommendations API
commerce/activitiesApitrackViewReco( recommenderName: string,\\The name of the recommender. recoUUID: string,\\A string representing the unique ID for this recommendation response products: Products,\\The products displayed to the customer. A list of one or more 18-character product IDs sku: string):\\(Optional) A unique stock keeping unit identifier for the product voidCommerce55.0Triggers the viewReco activity when a recommendation is displayed to the customer.

Implement this activity when building a custom Commerce Einstein recommendations component.

If you calculate a recommendation but don’t show it to the customer—for example, it doesn’t have as many results as you like—don’t fire this activity.

Einstein Recommendations API
commerce/cartApiaddItemToCart(productId: string, quantity: number) : Promise>Commerce57.0Adds an item to a cart.Commerce Webstore Cart Items
commerce/cartApiaddItemsToCart(payload: AddItemsToCartActionPayload) : Promise>Commerce57.0Adds multiple items to the cart.Commerce Webstore Cart Items
commerce/cartApiapplyCouponToCart(couponCode: string) : Promise>Commerce57.0Applies a coupon to the cart.Commerce Webstore Cart Items
commerce/cartApideleteCouponFromCart(couponId: string) : Promise>Commerce57.0Deletes an applied coupon from the cart.Commerce Webstore Cart Items
commerce/cartApideleteCurrentCart() : Promise>Commerce57.0Deletes an active/current cart.Commerce Webstore Cart Items
commerce/cartApideleteItemFromCart(itemId: string) : Promise>Commerce57.0Deletes an item from the cart.Commerce Webstore Cart Items
commerce/cartApirefreshCartSummary() : Promise>Commerce58.0Refreshes the cart summary.Commerce Webstore Cart Items
commerce/cartApiupdateCartStatusProcessing(status: boolean) : Promise>Commerce58.0Sets the isProcessing status field of the cart to the provided processing state.Commerce Webstore Cart Items
commerce/cartApiupdateItemInCart(itemId: string, quantity: number) : Promise>Commerce57.0Updates the item quantity in the cart.Commerce Webstore Cart Items
commerce/checkoutApiauthorizePayment(checkoutId, tokenResponse.token, billingAddress): PromiseCommerce56.0Authorizes a tokenized payment for a checkout session.Commerce Webstore Checkout
commerce/checkoutApicheckoutStatusIsReady(checkoutStatus: CheckoutStatus | undefined): booleanCommerce60.0Returns true if the supplied checkout status is complete and will accept additional parametersCommerce Webstore Checkout
commerce/checkoutApicreateContactPointAddress(address: Address): Promise
Commerce56.0Creates a contact point address record.

This API doesn’t affect the checkout session.

Commerce Webstore Checkout
commerce/checkoutApiloadCheckout(): PromiseCommerce57.0Loads the checkout session or error and saves it in the store for access by the wire adapter.Commerce Webstore Checkout
commerce/checkoutApinotifyCheckout(state: CheckoutInformation | Error | null): PromiseCommerce57.0Publishes an updated checkout session state to the store so changes can be propagated by the wire adapter to subscribed listeners.

Passing an Error replaces the checkout state and checkout ID with the error state.

Passing null clears the published data cache. Returns the passed in data unmodified.

Commerce Webstore Checkout
commerce/checkoutApinotifyAndPollCheckout(state: CheckoutInformation | Error | null): Promise Commerce57.0Calls notifyCheckout with supplied data.

Additionally, when state indicates an async computation in progress (httpStatus is 202), it calls loadCheckout to poll until async tasks complete.

Automatically triggers a cart summary refresh if needed.

Commerce Webstore Checkout
commerce/checkoutApiplaceOrder(): PromiseCommerce56.0Finalizes the order, completing the active checkout session.Commerce Webstore Checkout
commerce/checkoutApipostAuthorizePayment(checkoutId: string, paymentsData: map\, paymentToken: string, billingAddress?: Address): PromiseCommerce56.0Sends a client-side authorization result to the server.Commerce Webstore Checkout
commerce/checkoutApirestartCheckout(): PromiseCommerce56.0Restarts an active checkout process.

Before you use this API, clear all cached checkout and address data to prepare for a new “active” session. Clear cache is required anytime the previous checkout session becomes invalid. Attempts to use other checkout APIs after the previous session become invalid and fail until the restart is called.

Commerce Webstore Checkout
commerce/checkoutApisimplePurchaseOrderPayment(checkoutId: string, tokenResponseToken: string, billingAddress: Address): Promise B2B Commerce57Sends an authenticated buyer's simple purchase order number to the server.Commerce Webstore Checkout
commerce/checkoutApiupdateContactInformation(contactInfo: ContactInfo): PromiseCommerce56.0Updates the guest contact information in the active checkout session.Commerce Webstore Checkout
commerce/checkoutApiupdateContactPointAddress(address: Address): Promise
Commerce56.0Updates an existing contact point address record.

This API doesn’t affect the checkout session.

Commerce Webstore Checkout
commerce/checkoutApiupdateDeliveryMethod(deliveryMethodId: string): PromiseCommerce56.0Updates the delivery method for the default delivery group in the active checkout session, and updates the cart summary.Commerce Webstore Checkout
commerce/checkoutApiupdateGuestEmail(guestEmail: string | undefined): PromiseCommerce56.0Updates the cached guest email value that’s shared between components.

This API doesn’t affect the checkout session.

Commerce Webstore Checkout
commerce/checkoutApiupdateShippingAddress(deliveryGroup: DeliveryGroup): PromiseCommerce56.0Updates the shipping address for the default delivery group in the active checkout session.Commerce Webstore Checkout
commerce/checkoutApiwaitForCheckout(): PromiseCommerce57.0Returns a resolved promise immediately if the checkout status is complete. Otherwise, the returned promise resolves after the checkout status becomes complete or errors.Commerce Webstore Checkout
commerce/contextApigetAppContext(): PromiseCommerce53.0Get application-context-specific data.Commerce Webstore Application Context
commerce/contextApigetSessionContext(): PromiseCommerce53.0Get session-context-specific data.Commerce Webstore Application Context
commerce/myAccountApicreateMyAccountAddress( address: MyAccountAddress ): PromiseCommerce54.0Create an account address.Commerce Webstore Account Address
commerce/myAccountApideleteMyAccountAddress( addressId: string ): PromiseCommerce54.0Delete an account address.Commerce Webstore Account Address
commerce/myAccountApiupdateMyAccountAddress( address: MyAccountAddress ): PromiseCommerce54.0Update an account address.Commerce Webstore Account Address
commerce/myAccountApiresetPassword( username: string ): PromiseCommerce Reset a password.Commerce Webstore Account Address
commerce/myAccountApiupdateMyAccountProfile(profile: MyAccountProfileRequestOptions): PromiseCommerce59.0Update an existing account profile.Commerce Webstore Account Address
commerce/orderApistartReOrder(options: OrderActionAddToCartRequestOptions): PromiseCommerce57.0 Commerce Checkout Order
experience/cmsEditorApicontentBodyModify['propertyOfContentType'] = 'new value'; updateContent({ contentBody: contentBodyModify }).then(() => { });CMS54.0Updates the property to be updated in content form. Then calls back after the form is updated.CMS Content
experience/effectiveAccountApieffectiveAccount.update( 'Sample Account Id' , 'Sample Account Name' ); // To set the effective account Id and account name in session storage.

const accountId = effectiveAccount.accountId // To read the effective account Id from session storage.

const accountName = effectiveAccount.accountName // To read the effective account name from session storage. });

Commerce57Sets the account name and id in session storage.B2B and D2C Commerce Resources

Namespace/BundleAdapterProductAPI VersionDescriptionAssociated Endpoint
commerce/cartApiCartAdapterCommerce60.0Retrieves total count of items in the cart.Commerce Webstore Cart
commerce/cartApiCartCouponsAdapterCommerce55.0Retrieves cart coupon information, loads cart coupons.Commerce Webstore Cart Coupons
commerce/cartApiCartItemsAdapterCommerce53.0Fetches and loads cart items, supports sorting.Commerce Webstore Cart Items
commerce/cartApiCartPromotionsAdapterCommerce55.0Retrieves and loads cart-level and item promotion information when eligible items are added or updated.Commerce Webstore Cart Promotions
commerce/cartApiCartSummaryAdapterCommerce53.0Fetches current cart totals data from rollup calculators for CartBadge, CartSummary, Checkout, and other components.Commerce Webstore Cart
commerce/cartApiCartStatusAdapterCommerce58.0Retrieves status information about a cart, including whether a cart is processing, whether a cart is ready for checkout, and whether guest cart or checkout access is enabled.Commerce Webstore Cart
commerce/checkoutApiCheckoutAddressAdapterCommerce56.0Uses multiple calls to aggregate results for the get-address-list API. This adapter is a deeper get-address-list API wrapper.Commerce Webstore Checkout
commerce/checkoutApiCheckoutGuestEmailAdapterCommerce56.0Retrieves guest email info value from the store.Commerce Webstore Checkout
commerce/checkoutApiCheckoutInformationAdapterCommerce56.0Retrieves data from CheckoutStore, guest email info value from the store, the deliveryGroup, and the first shippingInstructions in the store. Called one time at startup and then whenever the data store updates.Commerce Webstore Checkout
commerce/contextApiAppContextAdapterCommerce53.0Retrieves app context data from the AppContext store. If data hasn’t been loaded, the adapter calls the application context API.Application Context
commerce/contextApiSessionContextAdapterCommerce53.0Retrieves session context data from the SessionContext store. If data hasn’t been loaded, the adapter calls the session context API.Session Context
commerce/orderApiOrderAdapterCommerce57.0Called when a buyer views the order summary of an order. Retrieves an order summary, including fields, based on the effective account ID.Commerce Webstore Order Summary
commerce/orderApiOrdersAdapterCommerce57.0Called when a buyer views their order history page. Retrieves order summaries, including fields, for the buyer associated with the storefront.Commerce Webstore Order Summaries
commerce/orderApiOrdersAdjustmentsAdapterCommerce57.0Called when a buyer views the order summary of an order. Retrieves adjustments for an order summary.Commerce Webstore Order Summary, Adjustments
commerce/orderApiOrderDeliveryGroupsAdapterCommerce57.0Called when a buyer views the order summary of an order. Retrieves an order delivery group.Commerce Webstore Order Delivery Groups
commerce/orderApiOrderItemsAdapterCommerce57.0Called when a buyer views the order summary of an order. Retrieves order items, including fields.Commerce Webstore Order Items
commerce/orderApiOrderItemsAdjustmentsAdapterCommerce57.0Called when a buyer views the order summary of an order. Retrieves adjustments for order items.Commerce Webstore Order Items, Adjustments
commerce/orderApiOrderSummaryLookupAdapterCommerce58.0Retrieves details about an OrderSummary for a guest shopper or a registered buyerCommerce Webstore Order Summary Lookup
commerce/productApiProductAdapterCommerce53.0Called when the product is loaded. Retrieves product information from the store.Commerce Webstore Product
commerce/productApiProductCategoryAdapterCommerce53.0Retrieves category information, including fields and related media.Commerce Webstore Product Category
commerce/productApiProductCategoryHierarchyAdapterCommerce53.0Retrieves a list of product category information, including fields and related media, based on the parent product category Id.Commerce Webstore Product Categories Children
commerce/productApiProductCategoryPathAdapterCommerce53.0Retrieves the category path from the root category to the current category.Commerce Webstore Product Category Path
commerce/productApiProductCategoryPathAdapterCommerce53.0Retrieves the category path from the root category to the current category.Commerce Webstore Product Category Path
commerce/productApiProductChildrenAdapterCommerce57.0Retrieves child product information including pricing, inventory, and promotional pricing. Based on the parent product category ID.[Commerce Webstore Product Children
commerce/productApiProductPricingAdapterCommerce53.0Called when the product is loaded. Retrieves tiered pricing information for a given product.Commerce Webstore Pricing Product
commerce/productApiProductSearchAdapterCommerce57.0Retrieves products by search parameters.Commerce Webstore Product Search
commerce/productApiProductTaxAdapterCommerce57.0Retrieves tax information for a given product.Commerce Webstore Taxes
commerce/recommendationsApiProductRecommendationsAdapterCommerce55.0Returns Einstein product recommendations. Import it from the einsteinAPI module within the commerce namespace (commerce/einsteinAPI) and then declare its required parameters with the @wire decorator.B2C Commerce Einstein Product Recommendations API
Namespace/BundleWire AdapterProductAPI VersionDescriptionAssociated Endpoint
experience/navigationMenuApigetNavigationMenuPlatform54.0Retrieves the items for a navigation menu in an Experience Cloud site.Navigation Menu Items
experience/cmsDeliveryApigetContentCMS54.0Retrieves published content from an enhanced CMS workspace to use in a custom Lightning web component for an enhanced LWR site.CMS Delivery Content
experience/cmsEditorApigetContextCMS54.0Retrieve metadata about the content item in the CMS content editor.CMS Content
experience/cmsEditorApigetContentCMS54.0Retrieve the title, urlName, and contentBody of the content item based on the content type: image, news, document, or custom content.CMS Content

Storefront Actions are centrally combined in the component bundle commerce/actionApi. The table shows the factory methods for this bundle.

CategoryNameProductAPI VersionDescriptionPropertiesactionApi Source
CartcreateCartItemAddActionCommerce58.0Returns an Action that triggers an add-item-to-cart operation from the closest applicable Data Provider.productId: stringquantity?: numberCommerce Webstore Cart Items
CartcreateCartItemUpdateActionCommerce58.0Returns an Action that triggers an update to cart contents operation from the closest applicable Data Provider.cartItemId: stringquantity: numberCommerce Webstore Cart Items
CartcreateCartItemDeleteActionCommerce58.0Returns an Action that triggers a remove-item-in-cart operation from the closest applicable Data Provider.cartItemId: stringCommerce Webstore Cart Items
CartcreateCartItemsAddActionCommerce58.0Returns an Action that triggers an add items in cart operation from the closest applicable Data Provider.items: Record<string, number>Commerce Webstore Cart Items
CartcreateCartItemsLoadActionCommerce58.0Returns an Action that triggers a load more cart items operation from the closest applicable Data Provider.Commerce Webstore Cart Items
CartcreateCartSortUpdateActionCommerce58.0Returns an Action that triggers an update cart sort order operation from the closest applicable Data Provider.sortOrder?: 'CreatedDateDesc' | 'CreatedDateAsc' | 'NameDesc' | 'NameAsc'Commerce Webstore Cart Items
CartcreateCartStatusUpdateActionCommerce58.0Returns an Action that triggers an update cart status operation from the closest applicable Data Provider.status?: { isProcessing?: boolean; isReadyForCheckout?: boolean; isGuestCartEnabled?: boolean; isGuestCheckoutEnabled?: boolean;}Commerce Webstore Cart Items
CartcreateCartClearActionCommerce58.0Returns an Action that triggers a clear cart operation from the closest applicable Data Provider. Commerce Webstore Cart Items
CartcreateCartInventoryReserveActionCommerce59.0Returns an Action that triggers a reserve inventory for cart items operation from the closest applicable Data Provider. Commerce Webstore Cart Items
CheckoutcreateCheckoutAddressesCreateActionCommerce58.0Returns an Action that triggers a checkout addresses create operation from the closest applicable Data Provider.address: { name?: string; firstName?: string; lastName?: string; companyName?: string; street?: string; city?: string; postalCode?: string; region?: string; country?: string; addressId?: string; id?: string; fields?: unknown; geocodeAccuracy?: string; isDefault?: boolean; addressType?: string; label?: string;}checkout ActionApi
CheckoutcreateCheckoutAddressesPageChangeActionCommerce58.0Returns an Action that triggers a checkout addresses page change from the closest applicable Data Provider.total: numberCommerce Webstore Checkout
CheckoutcreateCheckoutAddressesUpdateActionCommerce58.0Returns an Action that triggers a checkout addresses update from the closest applicable Data Provider.address: { name?: string; firstName?: string; lastName?: string; companyName?: string; street?: string; city?: string; postalCode?: string; region?: string; country?: string; addressId?: string; id?: string; fields?: unknown; geocodeAccuracy?: string; isDefault?: boolean; addressType?: string; label?: string;}Commerce Webstore Checkout
CheckoutcreateCheckoutFinalizeActionCommerce58.0Returns an Action that triggers a finalize action from the closest applicable Data Provider. Commerce Webstore Checkout
CheckoutcreateCheckoutPlaceOrderActionCommerce58.0Returns an Action that triggers a place order action from the closest applicable Data Provider. Commerce Webstore Checkout
CheckoutcreateCheckoutUpdateFormActionCommerce58.0Returns an Action that triggers a checkout update from the closest applicable Data Provider.* applicable {@link DataProvider}.Commerce Webstore Checkout
CommoncreateCommonQuantityUpdateActionCommerce59.0Returns an Action that triggers an update quantity from the closest applicable Data Provider.quantity: numberCommerce Webstore Cart Item
CouponcreateCouponApplyActionCommerce58.0Returns an Action that triggers an apply coupon from the closest applicable Data Provider.couponId: stringCommerce Webstore Cart Promotions
CouponcreateCouponDeleteActionCommerce58.0Returns an Action that triggers a delete coupon from the closest applicable Data Provider.couponId: stringCommerce Webstore Cart Promotions
OrdercreateOrderAccessValidateActionCommerce59.0Returns an Action that triggers an order summary access validate from the closest applicable Data Provider.verificationDetails: { orderSummaryIdOrRefNumber?: string; fields?: string[] | null; excludeAdjustments?: boolean | null; excludeAdjustmentAggregates?: boolean | null; excludeLineItems?: boolean | null; excludeDeliveryGroups?: boolean | null; email?: string | null; lastName?: string | null; phoneNumber?: string | null;}Commerce Webstore Order Summary
ProductcreateProductQuantityUpdateActionCommerce58.0Returns an Action that triggers an update product quantity from the closest applicable Data Provider.productId: stringquantity: numberCommerce Webstore Order Summary
ProductcreateProductVariantUpdateActionCommerce58.0Returns an Action that triggers an update product variant from the closest applicable Data Provider.options: string[]isValid: booleanCMS Contents Variant
ProductcreateProductSubscriptionUpdateActionCommerce59.0Returns an Action that triggers an update product subscription from the closest applicable Data Provider.productSellingModelId: stringsubscriptionTerm?: number | nullSubscription
SearchcreateSearchSortUpdateActionCommerce58.0Returns an Action that triggers an update search sort order from the closest applicable Data Provider.sortRuleId?: stringCommerce Webstore Product Search
SearchcreateSearchFiltersUpdateActionCommerce58.0Returns an Action that triggers an update search filters from the closest applicable Data Provider. refinements?: ProductSearchRefinement[]; categoryId?: string; page?: number; mruFacet?: SearchFacetData;}Commerce Webstore Product Search
SearchcreateSearchFiltersClearActionCommerce58.0Returns an Action that triggers a clear search filters from the closest applicable Data Provider. Commerce Webstore Product Search
WishlistcreateWishlistItemAddActionCommerce58.0Returns an Action that triggers an add items to wishlist from the closest applicable Data Provider.productId: stringCommerce Webstore Wishlists
WishlistcreateWishlistItemDeleteActionCommerce58.0Returns an Action that triggers an delete items to wishlist from the closest applicable Data Provider.wishlistItemId: stringCommerce Webstore Wishlists