31 January 2023
CartsOrdersGraphQL
To align with the HTTP API, multiple Shipping Methods are now supported on Carts and Orders in the GraphQL API.
Changes:
- [GraphQL API] Added the following types to the GraphQL schema: 
AddCartCustomShippingMethod,AddCartShippingMethod,CustomShippingDraft,MethodTaxRate,RemoveCartShippingMethod,Shipping,ShippingDraft,ShippingMode. - [GraphQL API] Changed the 
MyCartDrafttype:- Input field 
shippingModewas added toMyCartDrafttype - Input field 
customShippingwas added toMyCartDrafttype - Input field 
shippingwas added toMyCartDrafttype 
 - Input field 
 - [GraphQL API] Changed the 
CartDrafttype:- Input field 
customShippingwas added toCartDrafttype - Input field 
shippingwas added toCartDrafttype - Input field 
shippingModewas added toCartDrafttype 
 - Input field 
 - [GraphQL API] Changed the 
CartUpdateActiontype:- Input field 
addCustomShippingMethodwas added toCartUpdateActiontype - Input field 
removeShippingMethodwas added toCartUpdateActiontype - Input field 
addShippingMethodwas added toCartUpdateActiontype 
 - Input field 
 - [GraphQL API] Changed the 
Carttype:- Added the 
taxedShippingPricefield to theCarttype. - Added the 
shippingfield to theCarttype. - Added the 
shippingModefield to theCarttype. 
 - Added the 
 - [GraphQL API] Changed the 
Ordertype:- Added the 
taxedShippingPricefield to theOrdertype. - Added the 
shippingfield to theOrdertype. - Added the 
shippingModefield to theOrdertype. 
 - Added the 
 - [GraphQL API] Changed the 
LineItemtype:- Added the 
perMethodTaxRatefield to theLineItemtype. - Added the 
taxedPricePortionsfield to theLineItemtype. 
 - Added the 
 - [GraphQL API] Changed the 
ShippingTargetDrafttype:- Added the 
shippingMethodKeyfield to theShippingTargetDrafttype. 
 - Added the 
 
The following changes were introduced in terms of GraphQL SDL:
extend type Cart {
  shipping: [Shipping!]!
  shippingMode: ShippingMode!
  taxedShippingPrice: TaxedPrice
}
extend type Order {
  shipping: [Shipping!]!
  shippingMode: ShippingMode!
  taxedShippingPrice: TaxedPrice
}
extend type LineItem {
  perMethodTaxRate: [MethodTaxRate!]!
  taxedPricePortions: [MethodTaxedPrice!]!
}
extend input MyCartDraft {
  customShipping: [CustomShippingDraft!] = []
  shipping: [ShippingDraft!] = []
  shippingMode: ShippingMode = Single
}
extend input CartDraft {
  customShipping: [CustomShippingDraft!] = []
  shipping: [ShippingDraft!] = []
  shippingMode: ShippingMode = Single
}
extend input CartUpdateAction {
  addCustomShippingMethod: AddCartCustomShippingMethod
  addShippingMethod: AddCartShippingMethod
  removeShippingMethod: RemoveCartShippingMethod
}
extend input ShippingTargetDraft {
  shippingMethodKey: String
}
input AddCartCustomShippingMethod {
  shippingKey: String!
  shippingMethodName: String!
  shippingAddress: AddressInput!
  shippingRate: ShippingRateDraft!
  shippingRateInput: ShippingRateInputDraft
  taxCategory: ResourceIdentifierInput
  externalTaxRate: ExternalTaxRateDraft
  custom: CustomFieldsDraft
  deliveries: [DeliveryDraft!] = []
}
input AddCartShippingMethod {
  shippingKey: String!
  shippingMethod: ResourceIdentifierInput!
  externalTaxRate: ExternalTaxRateDraft
  shippingAddress: AddressInput!
  shippingRateInput: ShippingRateInputDraft
  custom: CustomFieldsDraft
  deliveries: [DeliveryDraft!] = []
}
input CustomShippingDraft {
  key: String!
  shippingMethodName: String!
  shippingAddress: AddressInput!
  shippingRate: ShippingRateDraft!
  shippingRateInput: ShippingRateInputDraft
  taxCategory: ReferenceInput
  externalTaxRate: ExternalTaxRateDraft
  deliveries: [DeliveryDraft!]
  custom: CustomFieldsDraft
}
type MethodTaxRate {
  shippingMethodKey: String!
  taxRate: TaxRate
}
input RemoveCartShippingMethod {
  shippingKey: String!
}
type Shipping {
  shippingKey: String
  shippingInfo: ShippingInfo
  shippingAddress: Address
  shippingRateInput: ShippingRateInput
  shippingCustomFields: CustomFieldsType
}
input ShippingDraft {
  key: String!
  shippingMethod: ResourceIdentifierInput
  shippingAddress: AddressInput!
  shippingRateInput: ShippingRateInputDraft
  externalTaxRate: ExternalTaxRateDraft
  deliveries: [DeliveryDraft!]
  custom: CustomFieldsDraft
}
enum ShippingMode {
  "Allows multiple shipping methods for the cart with their respective shipping addresses"
  Multiple
  "Allows only one shipping method and shipping address for the cart"
  Single
}