# Carts

## GraphQL partial SDLs

This is a graphql reference page. In the llms.txt variant, those components link to the shared partial SDL key list instead of trying to resolve inline GraphQL reference content.

Fetch all available partial SDL keys first:

```text
GET https://docs.commercetools.com/apis/rest/content/by-id?id=ctp:gql-sphere:returnTypesList
```

Then fetch the one or more relevant partial SDL with a key from that list by calling the same endpoint with a schema ID:

```text
GET https://docs.commercetools.com/apis/rest/content/by-id?id=ctp:gql-sphere:schema:<key>
```

The response body is a JSON object keyed by the requested content ID. For example, the key-list request returns a `ctp:gql-sphere:returnTypesList` field and a schema request returns a `ctp:gql-sphere:schema:<key>` field.

**Queries and mutations for managing Carts in the platform.**

To access Carts as an Associate of a Business Unit, see [AsAssociateArgument](/api/graphql/business-units.md#asassociateargument).

## Queries

### Query Carts

[fetch SDL for query carts](#graphql-partial-sdls).

### Get Cart

[fetch SDL for query cart](#graphql-partial-sdls).

### Get active Cart

[fetch SDL for query customerActiveCart](#graphql-partial-sdls).

## Mutations

### Create Cart

[fetch SDL for mutation createCart](#graphql-partial-sdls).

### Update Cart

[fetch SDL for mutation updateCart](#graphql-partial-sdls).

### Delete Cart

[fetch SDL for mutation deleteCart](#graphql-partial-sdls).

## Output types

### Cart

[fetch SDL for type Cart](#graphql-partial-sdls).

### Cart Query Result

[fetch SDL for type CartQueryResult](#graphql-partial-sdls).

## Input types

### CartDraft

[fetch SDL for type CartDraft](#graphql-partial-sdls).

### CartUpdateAction

[fetch SDL for type CartUpdateAction](#graphql-partial-sdls).

### Update actions

#### on Cart

##### Set Key

[fetch SDL for type SetCartKey](#graphql-partial-sdls).

##### Set Customer ID

[fetch SDL for type SetCartCustomerId](#graphql-partial-sdls).

##### Set Customer Email

[fetch SDL for type SetCartCustomerEmail](#graphql-partial-sdls).

##### Set Customer Group

[fetch SDL for type SetCartCustomerGroup](#graphql-partial-sdls).

##### Set Anonymous ID

[fetch SDL for type SetCartAnonymousId](#graphql-partial-sdls).

##### Set Purchase Order Number

[fetch SDL for type SetCartPurchaseOrderNumber](#graphql-partial-sdls).

##### Set Business Unit &#x20;

[fetch SDL for type SetCartBusinessUnit](#graphql-partial-sdls).

##### Add LineItem

[fetch SDL for type AddCartLineItem](#graphql-partial-sdls).

##### Remove LineItem

[fetch SDL for type RemoveCartLineItem](#graphql-partial-sdls).

##### Change LineItems Order

[fetch SDL for type ChangeCartLineItemsOrder](#graphql-partial-sdls).

##### Add CustomLineItem

[fetch SDL for type AddCartCustomLineItem](#graphql-partial-sdls).

##### Remove CustomLineItem

[fetch SDL for type RemoveCartCustomLineItem](#graphql-partial-sdls).

##### Add Shopping List

[fetch SDL for type AddCartShoppingList](#graphql-partial-sdls).

##### Set Cart Total Tax

[fetch SDL for type SetCartTotalTax](#graphql-partial-sdls).

##### Change TaxMode

[fetch SDL for type ChangeCartTaxMode](#graphql-partial-sdls).

##### Change Price RoundingMode

[fetch SDL for type ChangeCartPriceRoundingMode](#graphql-partial-sdls).

##### Change Tax RoundingMode

[fetch SDL for type ChangeCartTaxRoundingMode](#graphql-partial-sdls).

##### Change TaxCalculationMode

[fetch SDL for type ChangeCartTaxCalculationMode](#graphql-partial-sdls).

##### Add DiscountCode

[fetch SDL for type AddCartDiscountCode](#graphql-partial-sdls).

##### Remove DiscountCode

[fetch SDL for type RemoveCartDiscountCode](#graphql-partial-sdls).

##### Set DirectDiscounts

[fetch SDL for type SetCartDirectDiscounts](#graphql-partial-sdls).

##### Set DirectDiscountsIgnoreCartDiscounts

[fetch SDL for type SetCartDirectDiscountsIgnoreCartDiscounts](#graphql-partial-sdls).

##### Add Payment

[fetch SDL for type AddCartPayment](#graphql-partial-sdls).

##### Remove Payment

[fetch SDL for type RemoveCartPayment](#graphql-partial-sdls).

##### Set Billing Address

[fetch SDL for type SetCartBillingAddress](#graphql-partial-sdls).

##### Set Shipping Address

[fetch SDL for type SetCartShippingAddress](#graphql-partial-sdls).

##### Add ItemShippingAddress

[fetch SDL for type AddCartItemShippingAddress](#graphql-partial-sdls).

##### Remove ItemShippingAddress

[fetch SDL for type RemoveCartItemShippingAddress](#graphql-partial-sdls).

##### Update ItemShippingAddress

[fetch SDL for type UpdateCartItemShippingAddress](#graphql-partial-sdls).

##### Add ShippingMethod

[fetch SDL for type AddCartShippingMethod](#graphql-partial-sdls).

##### Remove ShippingMethod

[fetch SDL for type RemoveCartShippingMethod](#graphql-partial-sdls).

##### Set ShippingMethod

[fetch SDL for type SetCartShippingMethod](#graphql-partial-sdls).

##### Add Custom ShippingMethod

[fetch SDL for type AddCartCustomShippingMethod](#graphql-partial-sdls).

##### Set Custom ShippingMethod

[fetch SDL for type SetCartCustomShippingMethod](#graphql-partial-sdls).

##### Set Estimated Delivery

[fetch SDL for type SetCartEstimatedDelivery](#graphql-partial-sdls).

##### Set ShippingRateInput

[fetch SDL for type SetCartShippingRateInput](#graphql-partial-sdls).

##### Set Locale

[fetch SDL for type SetCartLocale](#graphql-partial-sdls).

##### Set Country

[fetch SDL for type SetCartCountry](#graphql-partial-sdls).

##### Set DeleteDaysAfterLastModification

[fetch SDL for type SetCartDeleteDaysAfterLastModification](#graphql-partial-sdls).

##### Set Custom Type

[fetch SDL for type SetCartCustomType](#graphql-partial-sdls).

##### Set CustomField

[fetch SDL for type SetCartCustomField](#graphql-partial-sdls).

##### Set Reservation Expiration in Minutes&#x20;

[fetch SDL for type SetCartReservationExpirationInMinutes](#graphql-partial-sdls).

##### Recalculate

[fetch SDL for type RecalculateCart](#graphql-partial-sdls).

##### Freeze Cart

[fetch SDL for type FreezeCart](#graphql-partial-sdls).

##### Unfreeze Cart

[fetch SDL for type UnfreezeCart](#graphql-partial-sdls).

##### Lock Cart

[fetch SDL for type LockCart](#graphql-partial-sdls).

##### Unlock Cart

[fetch SDL for type UnlockCart](#graphql-partial-sdls).

##### Set RecurringPaymentConfiguration

[fetch SDL for type SetRecurringPaymentConfiguration](#graphql-partial-sdls).

##### Set RecurringPaymentStrategy

[fetch SDL for type SetRecurringPaymentStrategy](#graphql-partial-sdls).

##### Add RecurringPaymentAllocation

[fetch SDL for type AddRecurringPaymentAllocation](#graphql-partial-sdls).

##### Remove RecurringPaymentAllocation

[fetch SDL for type RemoveRecurringPaymentAllocation](#graphql-partial-sdls).

#### on Line Item

##### Change LineItem Quantity

[fetch SDL for type ChangeCartLineItemQuantity](#graphql-partial-sdls).

##### Set LineItem TaxRate

[fetch SDL for type SetCartLineItemTaxRate](#graphql-partial-sdls).

##### Set LineItem TaxAmount

[fetch SDL for type SetCartLineItemTaxAmount](#graphql-partial-sdls).

##### Set LineItem Price

[fetch SDL for type SetCartLineItemPrice](#graphql-partial-sdls).

##### Set LineItem TotalPrice

[fetch SDL for type SetCartLineItemTotalPrice](#graphql-partial-sdls).

##### Set LineItem DistributionChannel

[fetch SDL for type SetCartLineItemDistributionChannel](#graphql-partial-sdls).

##### Set LineItem SupplyChannel

[fetch SDL for type SetCartLineItemSupplyChannel](#graphql-partial-sdls).

##### Set LineItem ShippingDetails

[fetch SDL for type SetCartLineItemShippingDetails](#graphql-partial-sdls).

##### Apply DeltaToLineItemShippingDetailsTargets

[fetch SDL for type ApplyCartDeltaToLineItemShippingDetailsTargets](#graphql-partial-sdls).

##### Set LineItemRecurrenceInfo

[fetch SDL for type SetLineItemRecurrenceInfo](#graphql-partial-sdls).

##### Set LineItem Custom Type

[fetch SDL for type SetCartLineItemCustomType](#graphql-partial-sdls).

##### Set LineItem CustomField

[fetch SDL for type SetCartLineItemCustomField](#graphql-partial-sdls).

##### Set LineItem InventoryMode

[fetch SDL for type SetCartLineItemInventoryMode](#graphql-partial-sdls).

#### on Custom Line Item

##### Change CustomLineItem Quantity

[fetch SDL for type ChangeCartCustomLineItemQuantity](#graphql-partial-sdls).

##### Set CustomLineItem TaxRate

[fetch SDL for type SetCartCustomLineItemTaxRate](#graphql-partial-sdls).

##### Set CustomLineItem TaxAmount

[fetch SDL for type SetCartCustomLineItemTaxAmount](#graphql-partial-sdls).

##### Change CustomLineItem Price Mode

[fetch SDL for type ChangeCartCustomLineItemPriceMode](#graphql-partial-sdls).

##### Change CustomLineItem Money

[fetch SDL for type ChangeCartCustomLineItemMoney](#graphql-partial-sdls).

##### Set CustomLineItem ShippingDetails

[fetch SDL for type SetCartCustomLineItemShippingDetails](#graphql-partial-sdls).

##### Apply DeltaToCustomLineItemShippingDetailsTargets

[fetch SDL for type ApplyCartDeltaToCustomLineItemShippingDetailsTargets](#graphql-partial-sdls).

##### Set CustomLineItemRecurrenceInfo

[fetch SDL for type SetCustomLineItemRecurrenceInfo](#graphql-partial-sdls).

##### Set CustomLineItem Custom Type

[fetch SDL for type SetCartCustomLineItemCustomType](#graphql-partial-sdls).

##### Set CustomLineItem CustomField

[fetch SDL for type SetCartCustomLineItemCustomField](#graphql-partial-sdls).

#### on Billing Address

##### Set Billing Address Custom Type

[fetch SDL for type SetCartBillingAddressCustomType](#graphql-partial-sdls).

##### Set Billing Address CustomField

[fetch SDL for type SetCartBillingAddressCustomField](#graphql-partial-sdls).

#### on Shipping Address

##### Set Shipping Address Custom Type

[fetch SDL for type SetCartShippingAddressCustomType](#graphql-partial-sdls).

##### Set Shipping Address CustomField

[fetch SDL for type SetCartShippingAddressCustomField](#graphql-partial-sdls).

#### on ItemShipping Address

##### Set ItemShipping Address Custom Type

[fetch SDL for type SetCartItemShippingAddressCustomType](#graphql-partial-sdls).

##### Set ItemShipping Address CustomField

[fetch SDL for type SetCartItemShippingAddressCustomField](#graphql-partial-sdls).

#### on Shipping Method

##### Set ShippingMethod TaxAmount

[fetch SDL for type SetCartShippingMethodTaxAmount](#graphql-partial-sdls).

##### Set ShippingMethod TaxRate

[fetch SDL for type SetCartShippingMethodTaxRate](#graphql-partial-sdls).

#### on Shipping

##### Set Shipping Custom Type

[fetch SDL for type SetCartShippingCustomType](#graphql-partial-sdls).

##### Set Shipping CustomField

[fetch SDL for type SetCartShippingCustomField](#graphql-partial-sdls).

## Related pages

- [Search documentation and API specs](/search.md)