Create packaging options
The first step in determining how items should be packaged is to provide the packaging options that you commonly use to ship items.
Mutation
1
2
3
4
5
6
7
8
9
mutation createPackagingOptions(
$createPackagingOption: [PackagingOptionCreateInput!]!
) {
packagingOptionCreate(input: $createPackagingOption) {
id
type
name
}
}
Variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"createPackagingOption": [
{
"dimensionalUnit": "INCH",
"weightUnit": "POUND",
"type": "PACKAGE",
"height": 12,
"length": 8,
"width": 6,
"name": "test",
"weightCapacity": 5
},
{
"dimensionalUnit": "INCH",
"weightUnit": "POUND",
"type": "PACKAGE",
"height": 22,
"length": 28,
"width": 26,
"name": "test-2",
"weightCapacity": 5
}
]
}
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"data": {
"packagingOptionCreate": [
{
"id": "packaging_option_8ccb1e7e-3df5-4927-9122-b99ceb28d2a2",
"type": "PACKAGE",
"name": "test"
},
{
"id": "packaging_option_d69b0ea1-a0e8-4b77-8fa4-d1e21829141a",
"type": "PACKAGE",
"name": "test-2"
}
]
}
}
Cartonizing items for the shipment
Once you have provided packaging options, you will perform the cartonize
mutation. This will take in the shipTo
, shipFrom
, and item
details in order to properly determine which items will go in which box for shipping.
Mutation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
mutation {
partyCreateWorkflow(
input: [
{ type: ORIGIN, location: { countryCode: US } }
{ type: DESTINATION, location: { countryCode: CA } }
]
) {
id
}
itemCreateWorkflow(
input: [
{
quantity: 4
amount: 50
productId: "123"
description: "test 1223"
currencyCode: USD
measurements: [
{ type: WEIGHT, value: 10, unitOfMeasure: POUND }
{ type: LENGTH, value: 10, unitOfMeasure: INCH }
{ type: WIDTH, value: 5, unitOfMeasure: INCH }
{ type: HEIGHT, value: 2, unitOfMeasure: INCH }
]
}
]
) {
id
}
cartonizeWorkflow {
packagingOption {
name
}
id
width
length
height
dimensionalUnit
weight
weightUnit
items {
quantity
item {
productId
id
}
}
}
}
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
"data": {
"partyCreateWorkflow": [
{
"id": "party_ee2f80f2-0775-449e-a5f8-e8c5310f9c67"
},
{
"id": "party_0ea8c605-3a4b-4e19-8f1a-316cb8ddbe78"
}
],
"itemCreateWorkflow": [
{
"id": "item_d0cb6416-17cc-404f-9755-a93ce4356c38"
}
],
"cartonizeWorkflow": [
{
"packagingOption": {
"name": "Box 1"
},
"id": "carton_d0615c15-5158-4908-b818-9e5eeb7092ed",
"width": 5.0,
"length": 5.0,
"height": 10.0,
"dimensionalUnit": "INCH",
"weight": 20,
"weightUnit": "POUND",
"items": [
{
"quantity": 1,
"item": {
"productId": "123",
"id": "item_d0cb6416-17cc-404f-9755-a93ce4356c38"
}
},
{
"quantity": 1,
"item": {
"productId": "123",
"id": "item_d0cb6416-17cc-404f-9755-a93ce4356c38"
}
}
]
},
{
"packagingOption": {
"name": "Box 1"
},
"id": "carton_817de960-8e20-43c4-84c8-f8eedfea1f93",
"width": 5.0,
"length": 5.0,
"height": 10.0,
"dimensionalUnit": "INCH",
"weight": 20,
"weightUnit": "POUND",
"items": [
{
"quantity": 1,
"item": {
"productId": "123",
"id": "item_d0cb6416-17cc-404f-9755-a93ce4356c38"
}
},
{
"quantity": 1,
"item": {
"productId": "123",
"id": "item_d0cb6416-17cc-404f-9755-a93ce4356c38"
}
}
]
}
]
}
}
View packaging options
If you would like to view all packaging options that have been created for your store, you can run the following query:
Query
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
query {
packagingOptionsConnection(first: 30, filter: { source: ORGANIZATION }) {
totalCount
pageInfo {
startCursor
}
edges {
node {
id
length
width
height
weightCapacity
dimensionalUnit
weightUnit
createdAt
source
status
}
}
}
}
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"data": {
"packagingOptionsConnection": {
"totalCount": 1,
"pageInfo": {
"startCursor": "c2ltcGxlLW9mZnNldC1jdXJzb3Iw"
},
"edges": [
{
"node": {
"id": "packaging_option_ee73b5eb-37bd-4266-b7ed-ca4e8f1cf143",
"length": 102.0,
"width": 37.875,
"height": 0.25,
"weightCapacity": 5.0,
"dimensionalUnit": "INCH",
"weightUnit": "POUND",
"createdAt": "2023-06-01T19:42:55.622Z",
"source": "ORGANIZATION",
"status": "ENABLED"
}
}
]
}
}
}
Delete packaging options
If you have created a packaging option by mistake and need to have it deleted, you can use the packagingOptionDelete
mutation. This will make the status
as DISABLED
.
Mutation
1
2
3
4
5
mutation {
packagingOptionDelete(
input: "packaging_option_d69b0ea1-a0e8-4b77-8fa4-d1e21829141a"
)
}
Response
1
2
3
4
5
{
"data": {
"packagingOptionDelete": "SUCCESS"
}
}
Packaging and cartonization
Create packaging options and cartonize items prior to shipping.
GraphQL
When fulfilling orders, it is important to package your items in the most effective way possible. The
createPackagingOptions
mutation allow users to tell Zonos about the packaging options that you use. If no packaging options are provided to us, a default value of 8x4x2 is used. Once you have provided us with your packaging options, you can use thecartonize
mutation to determine which items should be placed in which package. These details can then be passed to the carrier to provide a more accurate shipping cost calculation.