Queries and mutations for managing the Carts of the authenticated Customer.
Queries
cart, carts, and activeCart fields on the me field. They are the same as the queries documented on the Carts page (Query Carts, Get Cart, and Get active Cart), but return only Carts of the authenticated Customer.Mutations
Create My Cart
| Arguments | |
|---|---|
draft | |
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
Update My Cart
| Arguments | |
|---|---|
idString | |
versionLong | |
actionsArray of MyCartUpdateAction | |
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
Delete My Cart
| Arguments | |
|---|---|
idString | |
versionLong | |
storeKey | The mutation is only performed if the resource is part of the store. Can be used with store-specific OAuth permissions. |
Replicate My Cart
| Arguments | |
|---|---|
reference | |
Output types
cart, carts, and activeCart fields on the me field. These return Cart and CartQueryResult.Input types
MyCartDraft
customerId is determined by a password flow token and
automatically set on the resulting Cart.
The anonymousId is determined by a token for an anonymous session and
automatically set on the resulting Cart.currency | Currency the Cart uses. |
country | Used for Line Item price selection.
If used for Create Cart in Store, the provided country must be one of the Store's countries. |
inventoryMode | Determines how stock quantities are tracked for Line Items in the Cart. Can beNone, TrackOnly, ReserveOnOrder, or ReserveOnCartDefault: None |
custom | Custom Fields for the Cart. |
customerEmailString | Email address of the Customer the Cart belongs to. |
shippingAddress | Shipping address associated with the Cart. Determines eligible ShippingMethod rates and Tax Rates of Line Items. |
billingAddress | Billing address associated with the Cart. |
shippingMethod | Shipping Method for the Cart. If the referenced ShippingMethod has a predicate that does not match the Cart, an InvalidOperation error is returned when creating a Cart. |
taxMode | Determines how Tax Rates are set. The Can be Disabled TaxMode cannot be set.Disabled, External, ExternalAmount, or PlatformDefault: Platform |
locale | Language of the Cart. Must be one of the languages supported by the Project. |
deleteDaysAfterLastModificationInt | Number of days after the last modification before a Cart is deleted.
If not provided, the default value for this field configured in Project settings is assigned.
Create a ChangeSubscription for Carts to receive a ResourceDeletedDeliveryPayload upon deletion of the Cart. |
itemShippingAddressesArray of AddressInput | Multiple shipping addresses of the Cart. Each address must contain a
key that is unique in this Cart.
The keys are used by LineItems to reference these addresses under their shippingDetails.Eligible Shipping Methods or applicable Tax Rates are determined by the Cart Default: shippingAddress, and not itemShippingAddresses.[] |
discountCodesArray of String | code of the existing DiscountCodes to add to the Cart.[] |
store | ResourceIdentifier to the Store the Cart should belong to. Once set, it cannot be updated. |
businessUnit | ResourceIdentifier to the Business Unit the Cart should belong to. The Customer must be an Associate of the Business Unit. Only available for B2B-enabled Projects. |
purchaseOrderNumberString | |
shippingMode |
Multiple, or SingleDefault: Single |
customShippingArray of CustomShippingDraft | Default: [] |
shippingArray of ShippingDraft | Default: [] |
lineItemsArray of MyLineItemDraft | Line Items to add to the Cart. Default: [] |
InventoryMode
None- No inventory checks or modifications when adding items or ordering. Default for a new cart.
TrackOnly- Orders decrement the available quantity on the matching inventory entry; ordering fails only when no inventory entry exists for a line item.
ReserveOnOrder- Line items are reserved only for the duration of the ordering transaction; creating an order fails when an unavailable line item exists.
ReserveOnCart- Items are reserved when added to the cart. Not supported by this service.
TaxMode
Disabled- No taxes are added to the cart.
External- The tax rates are set externally per ExternalTaxRateDraft. A cart with this tax mode can only be ordered if all line items, all custom line items and the shipping method have an external tax rate set. The totalNet and totalGross as well as the taxPortions fields are calculated according to the taxRoundingMode.
ExternalAmount- The tax amounts and the tax rates as well as the tax portions are set externally per ExternalTaxAmountDraft. A cart with this tax mode can only be ordered if the cart itself and all line items, all custom line items and the shipping method have an external tax amount and rate set
Platform- The tax rates are selected from the TaxCategories based on the cart shipping address. The totalNet and totalGross as well as the taxPortions fields are calculated according to the taxRoundingMode.
ShippingMode
Multiple- Allows multiple shipping methods for the cart with their respective shipping addresses
Single- Allows only one shipping method and shipping address for the cart
CustomShippingDraft
keyString | User-defined unique identifier of the custom Shipping Method in the Cart with Multiple ShippingMode. |
shippingMethodNameString | Name of the custom Shipping Method. |
shippingAddress | Determines the shipping rate and Tax Rate of the associated Line Items. |
shippingRate | Determines the shipping price. |
shippingRateInput | Input used to select a ShippingRatePriceTier.
The data type of this field depends on the
shippingRateInputType.type configured in the Project:
|
taxCategory | Tax Category used to determine a shipping Tax Rate if the Cart has the Platform TaxMode. |
externalTaxRate | Tax Rate used to tax a shipping expense if the Cart has the External TaxMode. |
deliveriesArray of DeliveryDraft | Deliveries to be shipped with the custom Shipping Method. |
custom | Custom Fields for the custom Shipping Method. |
ShippingRateInputDraft
Classification | |
Score |
ClassificationShippingRateInputDraft
keyString | Key of the value used as a programmatic identifier. |
ScoreShippingRateInputDraft
scoreInt | Abstract value for categorizing a Cart. |
ExternalTaxRateDraft
nameString | Name of the Tax Rate. |
amountFloat | Percentage in the range of 0-1.
|
country | Country for which the tax applies. |
stateString | State within the specified country. |
subRatesArray of SubRateDraft | Used when the total tax is a combination of multiple taxes (for example, local, state/provincial, and/or federal taxes). The total of all subrates must equal the TaxRate Default: amount.
These subrates are used to calculate the taxPortions field of a Cart or Order and the taxedPrice field of LineItems, CustomLineItems, and ShippingInfos.[] |
includedInPriceBoolean |
false |
taxRoundingTarget | Determines whether the Can be taxRoundingMode of the Cart or Order is applied to the net price or the tax amount when includedInPrice is true. The field is ignored if includedInPrice is false.Net, or TaxDefault: Net |
SubRateDraft
nameString | |
amountFloat |
TaxRoundingTarget
Net- Default. `taxRoundingMode` is applied to the net price and the tax amount is the exact remainder. E.g. at 20% on `1.23`, the net rounds to `1.02` and the tax is `0.21`.
Tax- `taxRoundingMode` is applied to the tax amount and the net price is the exact remainder. E.g. at 20% on `1.23`, the tax rounds to `0.20` and the net is `1.03`. Has no effect when the rate is not included in the price.
DeliveryDraft
keyString | User-defined identifier of the Delivery. Must be unique among Deliveries in the Order. |
itemsArray of DeliveryItemDraftType | Line Items or Custom Line Items to deliver.
It can also be specified individually for each Parcel. |
parcelsArray of ParcelDraft | Information regarding the appearance, content, and shipment of a parcel. |
address | Address to which the Parcels are delivered. |
custom | Custom Fields for the Delivery. |
DeliveryItemDraftType
idString | |
quantityLong |
ParcelDraft
idString | |
keyString | |
createdAt | |
measurements | |
trackingData | |
itemsArray of DeliveryItemDraftType | Default: [] |
custom |
ParcelMeasurementsDraftType
heightInMillimeterInt | |
lengthInMillimeterInt | |
widthInMillimeterInt | |
weightInGramInt |
TrackingDataDraftType
trackingIdString | |
carrierString | |
providerString | |
providerTransactionString | |
isReturnBoolean | Default: false |
ShippingDraft
Wraps all shipping-related information (such as address, rate, deliveries) per Shipping Method for Carts with multiple Shipping Methods.
keyString | User-defined unique identifier for the Shipping in a Cart with Multiple ShippingMode. |
shippingMethod | Shipping Methods added to the Cart with Multiple ShippingMode. |
shippingAddress | Determines the shipping rate and Tax Rate of the associated Line Items. |
shippingRateInput | Input used to select a ShippingRatePriceTier.
The data type of this field depends on the
shippingRateInputType.type configured in the Project:
|
externalTaxRate | Tax Rate used for taxing a shipping expense if the Cart has the External TaxMode. |
deliveriesArray of DeliveryDraft | Deliveries to be shipped with the Shipping Method. |
custom | Custom Fields for Shipping. |
MyLineItemDraft
productId and variantId, or sku must be provided.keyString | User-defined identifier of the LineItem. Must be unique among LineItems in the Cart. |
productIdString | id of the Product. |
skuString | sku of the ProductVariant. |
quantityLong | Quantity of Product Variants to add to the Cart. |
variantIdInt | id of the ProductVariant in the Product.
If not provided, the Master Variant is used. |
supplyChannel | Used to identify Inventory entries that must be reserved.
The Channel must have the InventorySupply ChannelRoleEnum. |
distributionChannel | If the Cart is bound to a Store with distributionChannels set,
the Channel must match one of the Store's distribution channels. |
custom | Custom Fields for the Cart. |
shippingDetails | Container for Line Item-specific addresses. |
addedAt | Date and time (UTC) the Product Variant was added to the Cart. If not set, it defaults to the current date and time. Optional for backwards compatibility reasons. |
recurrenceInfo | Recurring Order and frequency data. |
ItemShippingDetailsDraft
targetsArray of ShippingTargetDraft | Default: [] |
shippingTargetsArray of ShippingMethodTargetDraft | Default: [] |
itemShippingAddressTargetsArray of ItemShippingAddressTargetDraft | Default: [] |
ShippingTargetDraft
addressKeyString | |
quantityLong | |
shippingMethodKeyString |
ShippingMethodTargetDraft
shippingMethodKeyString | |
quantityLong |
ItemShippingAddressTargetDraft
addressKeyString | |
quantityLong |
LineItemRecurrenceInfoInputDraft
recurrencePolicy | |
expiresAt | |
priceSelectionMode | Can be Dynamic, or Fixed |
MyCartUpdateAction
addDiscountCode | |
addItemShippingAddress | |
addPayment | |
addShoppingList | |
changeLineItemsOrder | |
changeTaxMode | |
recalculate | |
removeDiscountCode | |
removeItemShippingAddress | |
removeLineItem | |
removePayment | |
setBillingAddress | |
setBillingAddressCustomField | |
setBillingAddressCustomType | |
setBusinessUnit | |
setCountry | |
setCustomField | |
setCustomType | |
setCustomerEmail | |
setDeleteDaysAfterLastModification | |
setItemShippingAddressCustomField | |
setItemShippingAddressCustomType | |
setLineItemCustomField | |
setLineItemCustomType | |
setLineItemDistributionChannel | |
setLineItemShippingDetails | |
setLineItemSupplyChannel | |
setLocale | |
setShippingMethod | |
setShippingAddress | |
setShippingAddressCustomField | |
setShippingAddressCustomType | |
setShippingCustomField | |
setShippingCustomType | |
updateItemShippingAddress | |
applyDeltaToLineItemShippingDetailsTargets | |
applyDeltaToCustomLineItemShippingDetailsTargets | |
addLineItem | |
setLineItemRecurrenceInfo | |
setCustomLineItemRecurrenceInfo | |
changeLineItemQuantity |
Update actions
MyCartUpdateAction supports a subset of the CartUpdateAction update actions. Update actions that are not listed on this page are not available for My Carts. Update actions that use the same input type as on Carts link to their definition on the Carts page.Add DiscountCode
Add ItemShippingAddress
Add Payment
Add Shopping List
Change LineItems Order
Change TaxMode
taxMode | Can be Disabled, External, ExternalAmount, or Platform |
TaxMode
Disabled- No taxes are added to the cart.
External- The tax rates are set externally per ExternalTaxRateDraft. A cart with this tax mode can only be ordered if all line items, all custom line items and the shipping method have an external tax rate set. The totalNet and totalGross as well as the taxPortions fields are calculated according to the taxRoundingMode.
ExternalAmount- The tax amounts and the tax rates as well as the tax portions are set externally per ExternalTaxAmountDraft. A cart with this tax mode can only be ordered if the cart itself and all line items, all custom line items and the shipping method have an external tax amount and rate set
Platform- The tax rates are selected from the TaxCategories based on the cart shipping address. The totalNet and totalGross as well as the taxPortions fields are calculated according to the taxRoundingMode.
ChangeCartTaxMode. See Change TaxMode on Carts for the Cart version.Recalculate
Remove DiscountCode
Remove ItemShippingAddress
Remove LineItem
Remove Payment
Set Billing Address
Set Billing Address CustomField
Set Billing Address Custom Type
Set Business Unit B2B B2X
Set Country
Set CustomField
Set Custom Type
Set Customer Email
Set DeleteDaysAfterLastModification
Set ItemShipping Address CustomField
Set ItemShipping Address Custom Type
Set LineItem CustomField
Set LineItem Custom Type
Set LineItem DistributionChannel
Set LineItem ShippingDetails
Set LineItem SupplyChannel
Set Locale
Set ShippingMethod
shippingMethod |
SetCartShippingMethod. See Set ShippingMethod on Carts for the Cart version.Set Shipping Address
Set Shipping Address CustomField
Set Shipping Address Custom Type
Set Shipping CustomField
Set Shipping Custom Type
Update ItemShippingAddress
Apply DeltaToLineItemShippingDetailsTargets
Apply DeltaToCustomLineItemShippingDetailsTargets
Add LineItem
keyString | |
productIdString | |
skuString | |
quantityLong | |
variantIdInt | |
supplyChannel | |
distributionChannel | |
custom | |
shippingDetails | |
addedAt | |
recurrenceInfo |
ItemShippingDetailsDraft
targetsArray of ShippingTargetDraft | Default: [] |
shippingTargetsArray of ShippingMethodTargetDraft | Default: [] |
itemShippingAddressTargetsArray of ItemShippingAddressTargetDraft | Default: [] |
ShippingTargetDraft
addressKeyString | |
quantityLong | |
shippingMethodKeyString |
ShippingMethodTargetDraft
shippingMethodKeyString | |
quantityLong |
ItemShippingAddressTargetDraft
addressKeyString | |
quantityLong |
LineItemRecurrenceInfoInputDraft
recurrencePolicy | |
expiresAt | |
priceSelectionMode | Can be Dynamic, or Fixed |
AddCartLineItem. See Add LineItem on Carts for the Cart version.