Add parcel information to session
There are two ways of passing parcel information to a session:
- Create a packaging and set it as the default.
- Add parcel information during the session.
If you create a default packaging and you don't provide parcel details during a session, the default packaging will be used.
To add packaging information during session creation, use the parcels field. It requires two fields:
weight: The weight of the parcel in kilogramms. The field takes a float as a value.dimensions: The length, width, and height of the parcel in meters. Takes floats as values.
mutation {
session(
input: {
parcels: {
weight: 2,
dimensions: {
width: 1.5,
length: 2,
height: 0.5
}
}
}
)
{
id,
parcels {
weight
}
}
}
You can add additional costs to your parcels:
- Add insurance costs for parcel insurance.
- Add a cash on delivery cost.
note
All the relevant fields require the Money object type, with the amount and the currency specified.
mutation {
session(
input: {
parcels: {
weight: 2,
dimensions: {
width: 1.5,
length: 2,
height: 0.5
},
cashOnDelivery: {
amount: 1.5,
currency: EUR
},
insurance: {
amount: 5,
currency: EUR
}
}
}
)
{
id,
parcels {
weight
}
}
}