Merge Cart Behaviors
The Merge Cart Behaviors page provides an overview of the configuration settings and the associated functionalities.
To ensure your merged cart functions as intended, you must specify which configurations to activate when making a Merge carts request.
Merge Cart Behavior | Represents |
---|---|
MERGE | Include both primary and secondary resources, and in case of a conflict, override secondary data with primary data. For example, a coupon can be merged between carts. If one cart has no coupon and the other does, the merged cart will retain the coupon. However, if one cart has a 10% discount and the other has a 20% discount, the merge can’t happen exactly due to conflicting coupon functions. In this case, the 20% discount from the second cart will be discarded, and the merged cart will have the 10% discount. |
ALL | Include both primary and secondary resources together without checking for conflicts. This is mostly applicable for list resources. |
PRIMARY | Only include primary resources. |
SECONDARY | Only include secondary resources. |
PURGE | Remove both primary and secondary resources. |
REFERENCED | Add primary resources and retain only the secondary resources that are referred to in the merged cart. |
Merge Results
Validations merge
- Behavior for line item validation: Inherited from
mergeBehavior.item.behavior
. - Behavior for product catalog validation: Inherited from
mergeBehavior.item.behavior
.
When carts are merged, promotions are cleared due to updated items, quantities, taxes, or fulfillments in the cart. Additionally, a state is added to refresh the promotions.
Taxes
Taxes follow the same rules as the parent item. For example, if the item merge rule is set to secondary, the respective taxes are included accordingly.
When the item merge rule is set to MERGE
, taxes are cleared, and a state is added to the cart indicating that the item is missing taxes. This adjustment is necessary because changes in quantities may require tax updates.
Item quantity behavior
Item merge behaviors are:
- Default (SUM): Quantities of items with the same SKU are summed.
- MAX: The highest quantity of items with the same SKU is selected.
States
You must fully re-evaluate the state object for the merged cart from the response body to ensure the merged cart is configured with the intended settings.
Related Topics
Was this page helpful?