Saved Cart

The saved cart feature allows users to save one or more carts for later use. Users can benefit from the saved cart feature to enhance their online shopping experience.

For example, they can create a saved cart for items that they purchase on a regular basis, or they can create different saved carts for specific types of purchases.

For more information, see Multiple Saved Carts.

Enabling Saved Cart

You can enable the saved cart feature by installing the @spartacus/cart feature library.

For more information, see Installing Additional Composable Storefront Libraries.

The saved cart feature is CMS driven, and consists of the following CMS components:

  • AddToSavedCartsComponent

  • AccountSavedCartHistoryComponent

  • SavedCartDetailsOverviewComponent

  • SavedCartDetailsItemsComponent

  • SavedCartDetailsActionComponent

You can configure the saved cart feature by using SmartEdit to display the saved cart components in composable storefront, or you can manually add them to content slots using ImpEx.

If you are using the Spartacus Sample Data Extension, the saved cart components are already enabled. However, if you decide not to use the extension, you can enable them through ImpEx.

Adding CMS Components Manually

You can add the various saved cart CMS components to composable storefront using ImpEx.

$contentCatalog=powertools-spaContentCatalog
$contentCV=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]

You can enable the Saved Carts link in the My Account drop-down menu with the following ImpEx:

INSERT_UPDATE CMSLinkComponent;$contentCV[unique=true];uid[unique=true];name;url;&linkRef;&componentRef;target(code)[default='sameWindow'];restrictions(uid,$contentCV)
;;SavedCartsLink;Saved Carts Link;/my-account/saved-carts;SavedCartsLink;SavedCartsLink;;loggedInUser

You can enable the Saved Carts history page and Saved Carts Details page with the following ImpEx:

INSERT_UPDATE ContentPage;$contentCV[unique=true];uid[unique=true];label
;;saved-carts;/my-account/saved-carts
;;savedCartDetailsPage;/my-account/saved-cart

You can enable the Saved Carts and Save Cart for Later buttons with the following ImpEx:

INSERT_UPDATE CMSFlexComponent;$contentCV[unique=true];uid[unique=true];name;flexType
;;AddToSavedCartsComponent;Add To Saved Carts Component;AddToSavedCartsComponent

You can enable the saved cart history component with the following ImpEx:

INSERT_UPDATE CMSFlexComponent;$contentCV[unique=true];uid[unique=true];name;flexType
;;AccountSavedCartHistoryComponent;Account Saved Cart History Component;AccountSavedCartHistoryComponent

INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;cmsComponents(uid, $contentCV)
;;BodyContent-saved-carts;Body content for Saved Carts History Slot;AccountSavedCartHistoryComponent

You can enable the saved cart details components with the following ImpEx:

INSERT_UPDATE CMSFlexComponent;$contentCV[unique=true];uid[unique=true];name;flexType
;;SavedCartDetailsOverviewComponent;Saved Cart Details Overview Component;SavedCartDetailsOverviewComponent
;;SavedCartDetailsItemsComponent;Saved Cart Details Items Component;SavedCartDetailsItemsComponent
;;SavedCartDetailsActionComponent;Saved Cart Details Action Component;SavedCartDetailsActionComponent

INSERT_UPDATE ContentSlot;$contentCV[unique=true];uid[unique=true];name;cmsComponents(uid, $contentCV)
;;BodyContent-savedCartDetailsPage;Body content for Saved Carts Details Slot;SavedCartDetailsOverviewComponent,SavedCartDetailsItemsComponent,SavedCartDetailsActionComponent

User Interface

The saved cart feature extends the Cart interface with name, description and saveTime.

When saving a cart, the name is required, and the description is optional.

For detailed information on using the saved cart feature in the composable storefront, see Saved Cart User Interface.

Limitations

The current implementation of the saved cart feature has a number of limitations.

The saved cart feature does not currently work with the Configurable Products integration.

The saved cart feature also currently does not allow you to add multiple products to the active cart from the Saved Cart Details page.