13 July 2022
Enhancement
OrdersGraphQL

You can now create an Order by import using the GraphQL API.

Changes:

  • [GraphQL API] Added the following types to the GraphQL schema: CustomLineItemImportDraft, DeliveryDraft, DiscountedLineItemPriceDraft, ImportOrderDraft, LineItemImportDraft, ParcelDraft, ProductVariantImportDraft, ShippingInfoImportDraft, TaxRateInput, TaxedPriceDraft.
  • [GraphQL API] Changed the Mutation type:
    • Added the importOrder field to the Mutation type.

The following changes were introduced in terms of GraphQL SDL:

extend type Mutation {
importOrder(draft: ImportOrderDraft!): Order
}
input CustomLineItemImportDraft {
name: [LocalizedStringItemInputType!]!
quantity: Long!
money: BaseMoneyInput!
slug: String!
state: [ItemStateDraftType!]
taxRate: TaxRateInput
taxCategory: ResourceIdentifierInput
custom: CustomFieldsDraft
shippingDetails: ItemShippingDetailsDraft
}
input DeliveryDraft {
id: String!
createdAt: DateTime!
items: [DeliveryItemDraftType!]!
parcels: [ParcelDraft!]!
address: AddressInput
custom: CustomFieldsDraft
}
input DiscountedLineItemPortionDraft {
discount: ReferenceInput!
discountedAmount: BaseMoneyInput!
}
input DiscountedLineItemPriceDraft {
value: BaseMoneyInput!
includedDiscounts: [DiscountedLineItemPortionDraft!] = []
}
input ImportOrderDraft {
orderNumber: String
customerId: String
customerEmail: String
store: ReferenceInput
lineItems: [LineItemImportDraft!]! = []
customLineItems: [CustomLineItemImportDraft!]! = []
totalPrice: MoneyInput!
taxedPrice: TaxedPriceDraft
shippingAddress: AddressInput
billingAddress: AddressInput
customerGroup: ReferenceInput
country: Country
orderState: OrderState
shipmentState: ShipmentState
paymentState: PaymentState
shippingInfo: ShippingInfoImportDraft
completedAt: DateTime
custom: CustomFieldsDraft
inventoryMode: InventoryMode = None
shippingDetails: ItemShippingDetailsDraft
taxCalculationMode: TaxCalculationMode = LineItemLevel
origin: CartOrigin = Customer
itemShippingAddresses: [AddressInput!] = []
state: ReferenceInput
paymentInfo: ReferenceInput
}
input LineItemImportDraft {
productId: String
name: [LocalizedStringItemInputType!]!
price: ProductPriceDataInput!
quantity: Long!
supplyChannel: ResourceIdentifierInput
distributionChannel: ResourceIdentifierInput
taxRate: TaxRateInput
variant: ProductVariantImportDraft!
state: [ItemStateDraftType!]
custom: CustomFieldsDraft
shippingDetails: ItemShippingDetailsDraft
}
input ParcelDraft {
id: String!
createdAt: DateTime!
measurements: ParcelMeasurementsDraftType
trackingData: TrackingDataDraftType
items: [DeliveryItemDraftType!] = []
custom: CustomFieldsDraft
}
input ProductVariantImportDraft {
id: Int
sku: String
prices: [ProductPriceDataInput!] = []
images: [ImageInput!] = []
attributes: [ProductAttributeInput!] = []
}
input ShippingInfoImportDraft {
shippingMethodName: String!
price: MoneyInput!
shippingRate: ShippingRateDraft!
taxRate: TaxRateInput
taxCategory: ResourceIdentifierInput
deliveries: [DeliveryDraft!]! = []
shippingMethod: ResourceIdentifierInput
discountedPrice: DiscountedLineItemPriceDraft
shippingMethodState: ShippingMethodState! = MatchesCart
}
input TaxRateInput {
name: String!
amount: Float!
includedInPrice: Boolean!
country: Country!
state: String
id: String
subRates: [SubRateDraft!] = []
}
input TaxedPriceDraft {
totalNet: BaseMoneyInput!
totalGross: BaseMoneyInput!
taxPortions: [TaxPortionDraft!]!
totalTax: BaseMoneyInput
}