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
MyCartDraft
type:- Input field
shippingMode
was added toMyCartDraft
type - Input field
customShipping
was added toMyCartDraft
type - Input field
shipping
was added toMyCartDraft
type
- Input field
- [GraphQL API] Changed the
CartDraft
type:- Input field
customShipping
was added toCartDraft
type - Input field
shipping
was added toCartDraft
type - Input field
shippingMode
was added toCartDraft
type
- Input field
- [GraphQL API] Changed the
CartUpdateAction
type:- Input field
addCustomShippingMethod
was added toCartUpdateAction
type - Input field
removeShippingMethod
was added toCartUpdateAction
type - Input field
addShippingMethod
was added toCartUpdateAction
type
- Input field
- [GraphQL API] Changed the
Cart
type:- Added the
taxedShippingPrice
field to theCart
type. - Added the
shipping
field to theCart
type. - Added the
shippingMode
field to theCart
type.
- Added the
- [GraphQL API] Changed the
Order
type:- Added the
taxedShippingPrice
field to theOrder
type. - Added the
shipping
field to theOrder
type. - Added the
shippingMode
field to theOrder
type.
- Added the
- [GraphQL API] Changed the
LineItem
type:- Added the
perMethodTaxRate
field to theLineItem
type. - Added the
taxedPricePortions
field to theLineItem
type.
- Added the
- [GraphQL API] Changed the
ShippingTargetDraft
type:- Added the
shippingMethodKey
field to theShippingTargetDraft
type.
- 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
}