# Cart

## 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-il: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-il: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-il:returnTypesList` field and a schema request returns a `ctp:gql-il:schema:<key>` field.

**Read and update the Cart of the current session, and start payment.**

### Queries

#### Get Cart

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

#### Get Shipping Methods for Cart

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

#### Get payment methods

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

### Mutations

#### Add Line Item to Cart

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

#### Add Line Items to Cart

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

#### Change Line Item quantity

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

#### Set Custom Fields on Line Item

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

#### Remove Line Item from Cart

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

#### Empty Cart

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

#### Apply Discount Code

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

#### Remove Discount Code

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

#### Set shipping address

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

#### Set billing address

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

#### Set Customer email

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

#### Set purchase order number

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

#### Select Shipping Method for Cart

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

#### Remove Shipping Method from Cart

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

#### Start payment with Checkout

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

### Output types

#### Cart

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

#### Cart Line

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

#### Line Price Mode

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

#### Line Item Discounted Price

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

#### Product Discount Info

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

#### Portion

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

#### Price Totals

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

#### Applied Discount

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

#### Discount Source

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

#### Discount Target

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

#### Discount Value Type

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

#### Discount Group

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

#### Discount Combination

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

#### Discount Combination Mode

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

#### Best Deal Winner

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

#### Discount Code Info

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

#### Discount Code State

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

#### Shipping Method

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

#### Availability

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

#### Payment Method Option

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

#### Cart Origin

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

#### Cart Action

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

#### Cart Mutation Result

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

#### Begin Payment Result

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

### Input types

#### Add Cart Line Input

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

#### Update Cart Line Quantity Input

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

#### Update Cart Line Custom Fields Input

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

#### Remove Cart Line Input

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

#### Set Customer Email Input

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

#### Select Shipping Method Input

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

## Related pages

- [Area overview page with navigation](/commerce-integration-layer.md)
- [Previous page: Catalog](/commerce-integration-layer/experience/catalog.md)
- [Next page: Order](/commerce-integration-layer/experience/order.md)
- [Search documentation and API specs](/search.md)