Skip to content

Powered by Grav CMS + Helios Theme

Order statuses

The values each of an order's three status axes may hold.

The values each of an order's three status axes may hold. See Order statuses.

List order statuses

GET /api/v1/kahunacart/order-statuses Permission kahunacart.orders.view

Every order status this store has, grouped by the three axes an order carries — status (the cart lifecycle), payment_status and fulfillment_status — with a live count of how many orders stand in each. Each row has a stable code, the merchant's label, a colour, and the flags code branches on: flag (new, complete or cancelled), counts_as_paid, reduces_stock, restores_stock and is_final. Read this before setting a status on an order: the four values the plugin shipped with are no longer the only ones a store can have. is_seed rows cannot be deleted.

Add an order status

POST /api/v1/kahunacart/order-statuses Permission kahunacart.orders.manage

Add a status to one axis. axis, code and flag are required and the rest have defaults. The code is lowercase letters, digits and underscores, at most 16 characters, and it is permanent — every order that ever reaches this status stores it, so it cannot be renamed afterwards. flag is what every report, retention rule and add-on branches on and is the one field worth getting right: complete counts the order as a sale, cancelled takes it back out, new means it has not happened yet.

Parameters

Name Type Description
axis required string Which of the order's three status columns this value belongs to
One of: status, payment_status, fulfillment_status
code required string Permanent machine name, stored on every order that reaches it. At most 16 characters on the `status` axis and 20 on the other two, because the three columns it is written to are not the same width.
flag required string What this status means to code: not yet, done, or undone
One of: new, complete, cancelled
label optional string What a merchant sees. Free text, and changeable at any time.
colour optional string The pill tone in the admin
One of: ok, warn, info, bad, muted
Default: muted
position optional integer Where it sits on its axis. Defaults to the end.
enabled optional boolean
Default: true
counts_as_paid optional boolean Payment axis: has the money arrived?
Default: false
reduces_stock optional boolean Has stock left the shelf by this point?
Default: false
restores_stock optional boolean Do units go back on the shelf here?
Default: false
is_final optional boolean Nothing further will happen on this axis
Default: false

Change an order status

PATCH /api/v1/kahunacart/order-statuses/{id} Permission kahunacart.orders.manage

Rename, recolour, reposition, reflag or switch off one status. The axis and the code are not editable and are ignored if sent: every order already written carries the code. Switching off a status that orders are standing in is refused with the count. A built-in status can be changed here in every way except deleted.

Parameters

Name Type Description
id required integer Status id
label optional string or null
colour optional string
One of: ok, warn, info, bad, muted
position optional integer
flag optional string
One of: new, complete, cancelled
enabled optional boolean
counts_as_paid optional boolean
reduces_stock optional boolean
restores_stock optional boolean
is_final optional boolean

Delete an order status

DELETE /api/v1/kahunacart/order-statuses/{id} Permission kahunacart.orders.manage

Remove a status a merchant added. Refused with 409 for a built-in status — those can be renamed, recoloured and switched off but never removed, because the schema names several of them — and refused with 409 and a count for any status orders are currently standing in. Move those orders first.

Parameters

Name Type Description
id required integer Status id

Reorder one status axis

POST /api/v1/kahunacart/order-statuses/reorder Permission kahunacart.orders.manage

Put one axis in an order, posted as the whole list of ids in the order you want. Ids that are not on that axis are skipped rather than refused. The order decides how statuses appear in the admin's filters and menus and nothing else — it carries no meaning for code, which reads the flag.

Parameters

Name Type Description
axis required string
One of: status, payment_status, fulfillment_status
ids required array of integer Every status id on that axis, in the order you want them

The code is permanent, because every order that reaches the status stores it, and the flag is what decides whether those orders count as sales. A status KahunaCart seeded cannot be deleted, and neither can one orders are standing in; both refusals name what to do instead.