Add shipping information to an order
Add shipping information to an order with the shipping field. It requires the OrderShippingInput input type which provides fields for all relevant shipping information.
You can specify:
- The customer information, such as name, email, and phone.
- A delivery method: check ShippingMethodEnum for the options.
- A provider that will perform the delivery.
- The shipment status.
In addition, if the selected delivery method is pickup point delivery, you can add a pickup point ID.
mutation {
upsertOrder(
input: {
[...],
shipping: {
name: "Example Customer",
email: "ec@example.org",
phone: "0036701234567",
method: PICKUP_POINT,
provider: "Red Ivorp",
status: IN_PROGRESS,
}
}
)
}
Iff the selected delivery method is pickup point delivery, you can add a pickup point ID. That's where the order will be shipped to:
mutation {
upsertOrder(
input: {
[...],
shipping: {
name: "Example Customer",
email: "ec@example.org",
phone: "0036701234567",
pickupPointId: "123abc",
method: PICKUP_POINT,
provider: "Red Ivorp",
status: IN_PROGRESS,
}
}
)
}
For home delivery, add an address. An address requires a country code, a city, a postal code, and an address:
note
You can pass the address from the customer field of a session: Manage authenticated customers.
mutation {
upsertOrder(
input: {
[...],
shipping: {
name: "Example Customer",
email: "ec@example.org",
phone: "0036701234567",
pickupPointId: "123abc",
method: HOME_DELIVERY,
provider: "Red Ivorp",
status: IN_PROGRESS,
address: {
country: GB,
city: "Manchester"
postalCode: "M16 0RA"
addressLine1: "Sir Matt Busby Way"
}
}
}
)
}