Skip to content

Powered by Grav CMS + Helios Theme

Boxes and packing (add-on)

The box catalogue, the ship-from addresses, and what the packer would do with an order.

What a parcel is made from and where it leaves from. The packing preview reads with kahunacart.orders.view; the rest is setup. See Boxes and packing.

List boxes

GET /api/v1/kahunacart/shipping/boxes Permission kahunacart.shipping.manage

The box catalogue, with the usable space inside each box after the packing-material allowance, and the built-in fallback box a store with no boxes is quoted for.

Add a box

POST /api/v1/kahunacart/shipping/boxes Permission kahunacart.shipping.manage

Add a box to the catalogue. Measurements are whole millimetres and whole grams. A maximum weight of 0 means it has not been weighed, not that nothing fits.

Parameters

Name Type Description
code required string A short name you can type, such as `small` or `mug-box`.
name optional string What to call it on screen.
length_mm required integer Outside length in millimetres.
width_mm required integer Outside width in millimetres.
height_mm required integer Outside height in millimetres.
inner_length_mm optional integer or null Inside length, if known. Left out, the packer uses the outside less the packing allowance.
inner_width_mm optional integer or null Inside width, if known.
inner_height_mm optional integer or null Inside height, if known.
empty_weight_grams optional integer What the empty box weighs.
max_weight_grams optional integer The most the box may hold, contents and box. 0 means not said.
carrier_template optional string or null A carrier's own predefined package, where this box is one.
enabled optional boolean Whether the packer may use it.
position optional integer Where it sits in the list.

Update a box

PUT /api/v1/kahunacart/shipping/boxes/{id} Permission kahunacart.shipping.manage

Change a box in the catalogue.

Parameters

Name Type Description
id required integer The box's id.
code optional string
name optional string
length_mm optional integer
width_mm optional integer
height_mm optional integer
inner_length_mm optional integer or null
inner_width_mm optional integer or null
inner_height_mm optional integer or null
empty_weight_grams optional integer
max_weight_grams optional integer
carrier_template optional string or null
enabled optional boolean
position optional integer

Remove a box

DELETE /api/v1/kahunacart/shipping/boxes/{id} Permission kahunacart.shipping.manage

Take a box out of the catalogue. Orders already packed are not touched.

Parameters

Name Type Description
id required integer The box's id.

List ship-from addresses

GET /api/v1/kahunacart/shipping/locations Permission kahunacart.shipping.manage

The ship-from addresses, and whether the store has one at all — a store with none cannot be quoted by any carrier.

Add a ship-from address

POST /api/v1/kahunacart/shipping/locations Permission kahunacart.shipping.manage

Add a ship-from address. The first one added becomes the default, because a store with one address and no default cannot be quoted for.

Parameters

Name Type Description
code required string A short name you can type, such as `warehouse`.
name optional string Who the parcel is from. Either this or a company is needed.
company optional string
address_1 required string
address_2 optional string
city required string
state optional string
postcode optional string
country required string Two-letter country code, such as US or GB.
phone optional string
email optional string
is_default optional boolean Whether parcels ship from here unless something says otherwise.
enabled optional boolean
position optional integer

Update a ship-from address

PUT /api/v1/kahunacart/shipping/locations/{id} Permission kahunacart.shipping.manage

Change a ship-from address.

Parameters

Name Type Description
id required integer
code optional string
name optional string
company optional string
address_1 optional string
address_2 optional string
city optional string
state optional string
postcode optional string
country optional string
phone optional string
email optional string
is_default optional boolean
enabled optional boolean
position optional integer

Remove a ship-from address

DELETE /api/v1/kahunacart/shipping/locations/{id} Permission kahunacart.shipping.manage

Take a ship-from address out.

Parameters

Name Type Description
id required integer

Preview the packing

GET /api/v1/kahunacart/shipping/pack Permission kahunacart.orders.view

What the packer would do with an order, or with a made-up basket: the boxes, what goes in each, the actual and dimensional weights, which of the two the carrier would bill, and anything the packer had to guess at. Send either an order (its number, as on the receipt, or its id), an order_id, or a list of items. Both go in the query string — a made-up basket as items[0][qty]=5&items[0][length_mm]=90 and so on — because this reads and never writes, and a read expressed as a read is one a read-only store can still answer.

Parameters

Name Type Description
order optional string Pack a real order, named by the number on its receipt (1016, 01057 or #01057). An id works too when no order has that number.
order_id optional integer Or pack a real order by its id.
items optional array of object Or pack a made-up basket. Keys: `title`, `qty`, `length_mm`, `width_mm`, `height_mm`, `weight_grams`, `total_minor`