Pack Orders
Developer docs
Pack Orders is built to be extended. Packing state lives on WooCommerce’s own order line items, the plugin exposes a small REST namespace, and it fires actions and filters at every meaningful seam. There are no external services and no custom tables — the only network dependency is Freemius for Flow licensing. This page covers the public surface for v1.0.0 (code prefix POWC / powc_).
The packing model
Packing state is stored per line item, and the order-level status is only ever a derived cache — so it can never drift from the items.
_powc_state— order-item meta, the source of truth. One ofpacked,awaiting, or absent (= still to pack). The two set states are mutually exclusive._powc_status— order meta, a derived cache:to-pack,partly-packed,awaiting, orpacked. Always recomputed from the items, never authoritative.- Rollup rule: any one
awaitingitem ⇒ the order isawaiting(blocked); else all packed ⇒packed; some packed ⇒partly-packed; none ⇒to-pack. Only shippable items count (virtual/downloadable are skipped). - The cache is recomputed on
woocommerce_order_status_changed,woocommerce_saved_order_items, andwoocommerce_order_refunded.
Pack Orders never changes the WooCommerce order status — packing is a parallel layer. It reads status only to decide which orders are packable (default: Processing).
REST API
Namespace powc/v1. Every route is a write (POST), guarded by the edit_shop_orders capability and the standard X-WP-Nonce (wp_rest) header. Each response returns a recomputed summary so the client updates from server truth. Endpoints marked Flow are registered only when Flow is active.
| Endpoint | Body | Purpose |
|---|---|---|
POST /powc/v1/orders/{order}/items/{item}/state | state | Set one item’s state — to-pack, packed or awaiting. |
POST /powc/v1/orders/{order}/pack-all | — | Mark every shippable item on the order packed. |
POST /powc/v1/orders/{order}/reset | — | Clear all packing state on the order. |
POST /powc/v1/reorder/suppliers/{term}/place-order Flow | — | Create and place a supplier-order batch from that supplier’s awaiting items. |
POST /powc/v1/reorder/orders/{order}/items/{item}/resolve Flow | action | Resolve a batched line — received, next, or remove. |
Action hooks
These are the seams the Flow add-on itself hangs off — so your own add-ons can use them too. Everything ships in the free plugin.
| Hook | Fires when | Arguments |
|---|---|---|
powc_register_submenus | the Packing admin menu is built (add your own submenus) | $parent_slug, $cap |
powc_settings_fields | the Settings form renders (add cards inside it) | — |
powc_settings_after_form | after the Settings form (add standalone tool forms) | — |
powc_guide_after_sections Flow | the How-it-works guide renders (fires only when Flow is active) | — |
powc_fs_loaded | Freemius has finished loading (safe to call powc_fs()) | — |
Filter hooks
| Hook | Changes | Arguments |
|---|---|---|
powc_is_pro | the master “is Flow active” gate — return true to treat the install as licensed | false |
powc_awaiting_show_status | return true to add a Status column to the Awaiting list (Flow fills it) | false |
powc_awaiting_status_cell | the Status cell HTML for a product on the Awaiting list | '', $product |
Example — gate your own code on the Flow tier:
if ( apply_filters( 'powc_is_pro', false ) ) {
// Flow is active — safe to use supplier / re-order data.
}
JavaScript
- No admin-AJAX. Every write goes through the REST API above via
fetchwith theX-WP-Nonceheader — there are nowp_ajax_*actions. - JS config objects:
window.POWC(free —restRoot,nonce, status labels), plusPOWC_REORDERandPOWC_PICKFlow. - Action attributes: buttons carry
data-powc-action—await,pack-all,reset(free), andplace-order,resolve,pick-await,printFlow. - No shortcodes, no WP-CLI — the public surface is REST (write) + the hooks above.
Data & privacy
- No custom tables. Packing state lives in WooCommerce’s own order-item meta (
_powc_state) and a derived order-meta cache (_powc_status). Flow adds apowc_supplierproduct taxonomy (with contacts in term meta) and a privatepowc_supplier_orderbatch post type. - No third-party calls — nothing about an order leaves your store; the only network dependency is Freemius for Flow licensing.
- Capability-gated everywhere: every screen and REST write requires
edit_shop_orders; REST writes also require thewp_restnonce. - Clean uninstall removes the plugin’s options (packable statuses, the Flow auto-flag toggle, the per-user page size) but deliberately keeps
_powc_state/_powc_status, so packing history survives a reinstall.
Building an integration and need a hook that isn’t here? These are the stable, documented entry points for v1.0.0 — open a thread on the plugin’s WordPress.org support forum and we’ll point you at the right one.
