Shopping Carts
Cart Types
Cart types provide a mechanism for assigning configuration details to group of shopping carts. It is similar to how product types work for products. The cart type can contain references to multiple cart modifier groups that define cart modifiers, which are explained later.
Assigning cart types to a store
You can only define cart types through Import/Export, usually within data population. To assign cart types to a store:
In the
extensions/database/ext-data/src/main/resources/data/rel-1.0-data/importexport
folder, create astores.xml
file.Populate the
stores.xml
file.For more information about populating data, see Store and Warehouse in the Import/Export documentation.
Assign multiple cart types
You can assign multiple cart types to a store. The cart type that is used by the /carts
resource in Cortex is determined by reading the COMMERCE/STORE/shoppingCartItemListType
setting. The value of this setting represents the name of the cart type that is used. You can also specify context values where the store code is the key, allowing different cart types to be used in each store.
In future versions of Elastic Path Commerce:
- Cart types will be defined independently of a store and assigned to each store by Global Unique Identifier (GUID).
- Cart types will be managed within Commerce Manager.
- Cart types will contain additional properties that define the characteristics of a shopping cart, such as if they are cleaned up when abandoned or if they can be checked out.
- Different cart types can be used within a single store.
Cart Item Modifiers
Cart item modifiers are a mechanism for specifying fields that a shopper populates when adding an item to the shopping cart. You can also localize the field names into various languages. Define the following different data types as required or not:
ShortText
Date
Integer
Boolean
During checkout, any data that is populated within a cart item modifier is automatically transferred onto the corresponding purchase line item.
Cart item modifiers are useful when information must be collected at the shopping cart line-item level that:
Does not affect the price of the item.
Does not affect the attributes of the item.
Does not use a selectable list of option.
note
Instead of a selectable list of option, it typically uses free-form text. Examples of this are a custom message to be engraved or embroidered onto a product, or a message to the recipient for a gift certificate.
You can define cart item modifiers through Import/Export, usually within data population, or through Elastic Path Commerce Manager.
Defining cart item modifiers with data population
To define cart item modifiers through data population:
Create a
modifiergroups.xml
file in yourextensions/database/ext-data/src/main/resources/data/rel-1.0-data/importexport
folder.Populate the
modifiergroups.xml
file.For more information about populating
modifiergroups
see the Import/Exportmodifiergroups
documentation.Assign the cart item modifier group code or codes to each catalog by creating a
catalogs.xml
file in the same folder.Populate the
catalogs.xml
file.For more information about populating catalogs, see the Import/Export Catalogs documentation.
Define cart modifiers in Commerce Manager
To define cart modifiers within Elastic Path Commerce Manager:
Open the editor for a Catalog.
Open the
Cart Item Modifiers
tab.You can now define the cart modifiers.
Cart modifiers
Cart modifiers are similar to cart item modifiers, except that the field values are stored against the shopping cart instead of the shopping cart line item. Cart modifier values are specified by the shopper when a new custom cart is created. Any data that is populated within a cart modifier is automatically transferred onto the corresponding purchase during checkout.
Assigning cart types to a store
Currently cart modifiers can only be defined through Import/Export, usually within data population. To assign cart types to a store:
In the
extensions/database/ext-data/src/main/resources/data/rel-1.0-data/importexport
folder, create astores.xml
file.Populate the
stores.xml
file.For more information about populating data, see Store and Warehouse in the Import/Export documentation.
note
The cart type can contain references to multiple cart modifier groups that define cart modifiers. For more information, see the Multiple Carts section.
Dependent Line Items
Cortex allows shopping cart line items to be nested in a hierarchy. A shopping cart line item can have children associated to it, which are associated to their parent. If the parent is removed, they are also automatically removed.
By default, dependent line items are only populated by bundles. If a bundle is added to the shopping cart, the constituent products of that bundle are automatically added as dependent line items of the bundle line item in the shopping cart.
This feature can be customized so that dependent line items are added in other circumstances.
To access dependent line items in a shopping cart, add an item to cart in Cortex and then follow the dependentlineitems
link. If children exist, then this will contain a list of element
links for each child line item.
Multiple carts
Shoppers on each store are automatically assigned a default shopping cart. You can retrieve this shopping cart by going to the defaultcart
link from the root endpoint in Cortex.
Shoppers can create additional custom carts. To view existing carts or create a new cart, go to the carts
link from the root endpoint in Cortex. This link only appears for registered and logged in users. The link does not appear for anonymous shoppers.
Within this resource, clients can see a list of element
links representing the shopping carts. Clients can also use the createcartform
link to create a new shopping cart.
Custom shopping carts have their own associated order
link that allows addresses, payment methods, and other details to be specified. Each shopping cart can be checked out just like the default shopping cart.