You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merges items from an anonymous Cart into the most recently modified active Cart of a Customer. If no active Cart exists, a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned.
118
+
119
+
For more information, see [Merge behavior](/../api/carts-orders-overview#merge-behavior).
Copy file name to clipboardExpand all lines: api-specs/api/resources/in-store/carts-in-store.raml
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,42 @@ post:
117
117
},
118
118
]
119
119
description: Checks if one or more Carts exist for a Customer in a [Store](ctp:api:type:Store). Returns a `200` status if the Cart exists, or a `404` status otherwise.
120
+
/customer-id={customerId}/merge:
121
+
type: base
122
+
uriParameters:
123
+
customerId:
124
+
type: string
125
+
description: '`customerId` of the Customer.'
126
+
post:
127
+
displayName: Merge Cart in Store
128
+
securedBy:
129
+
[
130
+
oauth_2_0:
131
+
{
132
+
scopes:
133
+
[
134
+
'manage_orders:{projectKey}',
135
+
'manage_orders:{projectKey}:{storeKey}',
136
+
],
137
+
},
138
+
]
139
+
description: |
140
+
Merges items from an anonymous Cart into the most recently modified active Cart of a Customer. If no active Cart exists, a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned.
141
+
142
+
If the Cart exists in the Project but does not have a `store` specified, or the `store` field references a different Store, a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned.
143
+
144
+
For more information, see [Merge behavior](/../api/carts-orders-overview#merge-behavior).
Used for merging an anonymous Cart with a Customer Cart with the [Merge Cart](ctp:api:endpoint:/{projectKey}/carts/customer-id={customerId}/merge:POST) and [Merge Cart in Store](ctp:api:endpoint:/{projectKey}/in-store/key={storeKey}/carts/customer-id={customerId}/merge:POST) endpoints. Either `anonymousCart` or `anonymousId` is required.
7
+
properties:
8
+
anonymousCart?:
9
+
type: CartResourceIdentifier
10
+
description: |
11
+
[ResourceIdentifier](ctp:api:type:ResourceIdentifier) to the anonymous [Cart](ctp:api:type:Cart) to be merged. Required if `anonymousId` is not provided.
12
+
mergeMode?:
13
+
type: CartMergeMode
14
+
description: |
15
+
Determines how to merge the anonymous Cart with the existing Customer Cart.
16
+
default: MergeWithExistingCustomerCart
17
+
updateProductData?:
18
+
type: boolean
19
+
description: |
20
+
- If `true`, the [LineItem](ctp:api:type:LineItem) Product data (`name`, `variant`, and `productType`) of the returned Cart will be updated.
21
+
- If `false`, only the prices, discounts, and tax rates will be updated.
22
+
default: false
23
+
anonymousId?:
24
+
type: string
25
+
description: |
26
+
Assigns the Customer to the [Carts](ctp:api:type:Cart) that have the same `anonymousId`. Required if `anonymousCart` is not provided.
27
+
If both `anonymousCart` and `anonymousId` are provided, this value must match the `anonymousId` of the anonymous [Cart](ctp:api:type:Cart) otherwise, an [InvalidOperation](ctp:api:type:InvalidOperationError) error is returned.
Copy file name to clipboardExpand all lines: api-specs/graphql/schema.sdl
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2057,6 +2057,22 @@ type CartLimitsProjection {
2057
2057
total: CartLimitWithCurrent!
2058
2058
}
2059
2059
2060
+
enum CartMergeMode {
2061
+
"""
2062
+
`LineItem`s of the anonymous cart will be copied to the customer’s active cart that has been modified most recently.
2063
+
2064
+
The `CartState` of the anonymous cart gets changed to `Merged` while the `CartState` of the customer’s cart remains `Active`.
2065
+
2066
+
`CustomLineItems` and `CustomFields` of the anonymous cart will not be copied to the customers cart.
2067
+
2068
+
If a `LineItem` in the anonymous cart matches an existing line item in the customer’s cart (same product ID and variant ID), the maximum quantity of both LineItems is used as the new quantity. In that case `CustomFields` on the `LineItem` of the anonymous cart will not be in the resulting `LineItem`.
2069
+
"""
2070
+
MergeWithExistingCustomerCart
2071
+
2072
+
"The anonymous cart is used as new active customer cart. No `LineItem`s get merged."
2073
+
UseAsNewActiveCustomerCart
2074
+
}
2075
+
2060
2076
enum CartOrigin {
2061
2077
"The cart was created by the customer. This is the default value"
0 commit comments