1. Home
  2. Pick List
  3. Hooks & Custom Code
  4. Pick and Unpick Backend Hooks

Pick and Unpick Backend Hooks

Pick List for WooCommerce includes backend hooks for Pick and Unpick events.

These hooks are intended for developers who want to connect Pick List to external systems such as inventory tools, ERP software, warehouse systems, custom APIs, or internal automation.

The hooks run in PHP after Pick List has updated the order data and saved the order. This makes them more reliable than listening to frontend JavaScript or AJAX requests.

NOTE: Added in vs 2.6.13


Available hooks

cas_picklist_item_picked

Runs after an order item has been picked and the order has been saved.

do_action( 'cas_picklist_item_picked', $order, $order_item, $event_data );


cas_picklist_item_unpicked

Runs after an order item has been unpicked and the order has been saved.

do_action( 'cas_picklist_item_unpicked', $order, $order_item, $event_data );


cas_picklist_item_updated

Runs after either a Pick or Unpick event.

This can be used as a generic hook if you want to handle both actions in one place.

do_action( 'cas_picklist_item_updated', $order, $order_item, $event_data );


Parameters

All three hooks receive the same parameters.

$order

WooCommerce order object.

Type: WC_Order

$order_item

WooCommerce order item object for the line that changed.

Type: WC_Order_Item_Product

$event_data

An array with normalized event data for the change.

Type: array

$event_data keys

action

The event type.

Possible values:

  • pick
  • unpick

source

Where the event came from.

Possible values:

  • manual
  • barcode
  • barcode-legacy
  • bulk
  • reset

order_id

WooCommerce order ID.

order_item_id

WooCommerce order item ID.

product_id

Product ID.

variation_id

Variation ID if the item is a variation, otherwise 0.

requested_quantity

Quantity requested in the current action.

Examples:

  • manual pick of 2
  • barcode input quantity of 0.5
  • 0 for reset-based unpick events

picked_quantity

Picked quantity after the update has been saved.

previous_picked_quantity

Picked quantity before the update was saved.

required_quantity

Required quantity for the order line.

is_fully_picked

Whether the order item is now fully picked.

Type: bool

percent

Order pick progress percent after the update.

bulk_pick

Whether the event came from a bulk-pick style action.

Type: bool

barcode

Scanned barcode value for barcode-based events.

For non-barcode events this will be an empty string.

scan_all

Whether the barcode event used the scan-all workflow.

Type: bool

user_id

Current WordPress user ID that triggered the action.


When the hooks run

These hooks are triggered from Pick List backend workflows such as:

  • Manual Pick
  • Manual Unpick
  • Barcode scanning
  • Bulk Pick
  • Reset Pick

This gives developers one stable backend event model across different picking workflows.


Example: Picked item

add_action(
	'cas_picklist_item_picked',
	function( $order, $order_item, $event_data ) {
		if ( ! $order instanceof WC_Order ) {
			return;
		}

		$order_id      = $event_data['order_id'];
		$order_item_id = $event_data['order_item_id'];
		$product_id    = $event_data['product_id'];
		$picked_qty    = $event_data['picked_quantity'];
		$source        = $event_data['source'];

		// Send the picked item update to an external system.
	},
	10,
	3
);


Example: Unpicked item

add_action(
	'cas_picklist_item_unpicked',
	function( $order, $order_item, $event_data ) {
		if ( ! $order instanceof WC_Order ) {
			return;
		}

		$order_id      = $event_data['order_id'];
		$order_item_id = $event_data['order_item_id'];
		$previous_qty  = $event_data['previous_picked_quantity'];
		$current_qty   = $event_data['picked_quantity'];

		// Roll back or re-sync external quantities.
	},
	10,
	3
);


Example: Generic event handler

add_action(
	'cas_picklist_item_updated',
	function( $order, $order_item, $event_data ) {
		if ( 'pick' === $event_data['action'] ) {
			// Handle pick event.
		}

		if ( 'unpick' === $event_data['action'] ) {
			// Handle unpick event.
		}
	},
	10,
	3
);


Example: Sync only fully picked items

add_action(
	'cas_picklist_item_picked',
	function( $order, $order_item, $event_data ) {
		if ( empty( $event_data['is_fully_picked'] ) ) {
			return;
		}

		// Only sync fully picked items here.
	},
	10,
	3
);


Notes

  • The hooks run after Pick List has updated and saved the order data.
  • The hooks do not depend on frontend JavaScript.
  • Decimal quantities are supported.
  • picked_quantity and previous_picked_quantity are normalized numeric values.
  • If you sync to an external system, it is recommended to add error logging and retry handling in your own integration.

How can we help?