VAT
Your cart

Your cart is empty.

Customers and orders hooks

This page lists the 17 hooks of this group. Each entry shows its type, the version it arrived in, where it runs, its arguments and a starting point.

adba_customer_data

FilterSince 1.3.0 Runs in src/Modules/Customers/Customers.php.

Filters the customer shown on the detail screen.

Add keys for your own template or detail actions; the built-in keys (customer_id, user_id, name, email, orders_count, total_spent, …) keep their type, a value of another type is ignored.

ArgumentTypeDescription
$customerarray<string, mixed>Normalized customer.
add_filter( 'adba_customer_data', function ( $customer ) {
	return $customer;
} );

adba_customer_detail_after

ActionSince 1.3.0 Runs in templates/customers/detail.php.

Fires at the very end of the customer detail screen.

ArgumentTypeDescription
$customerarray<string, mixed>Normalized customer.
add_action( 'adba_customer_detail_after', function ( $customer ) {
	// ...
} );

adba_customer_detail_before

ActionSince 1.3.0 Runs in templates/customers/detail.php.

Fires at the top of the customer detail screen, under the title and notices.

ArgumentTypeDescription
$customerarray<string, mixed>Normalized customer (see adba_customer_data).
add_action( 'adba_customer_detail_before', function ( $customer ) {
	// ...
} );

adba_customer_detail_main

ActionSince 1.3.0 Runs in templates/customers/detail.php.

Fires in the main column of the customer detail screen, after the built-in cards (orders and note).

ArgumentTypeDescription
$customerarray<string, mixed>Normalized customer.
add_action( 'adba_customer_detail_main', function ( $customer ) {
	// ...
} );

adba_customer_detail_side

ActionSince 1.3.0 Runs in templates/customers/detail.php.

Fires in the card grid of the customer detail screen, after the address cards. Print a card with AddoBack\Support\Components::card() to match the others.

ArgumentTypeDescription
$customerarray<string, mixed>Normalized customer.
add_action( 'adba_customer_detail_side', function ( $customer ) {
	// ...
} );

adba_customer_note_saved

ActionSince 1.3.0 Runs in src/Modules/Customers/Customers.php.

Fires after the private note of a customer was saved.

ArgumentTypeDescription
$customerarray{customer_id: int, user_id: int, email: string}Who the note belongs to.
$notestringThe saved note.
add_action( 'adba_customer_note_saved', function ( $customer, $note ) {
	// ...
}, 10, 2 );

adba_customer_query_sorts

FilterSince 1.3.0 Runs in src/Modules/Customers/CustomerQuery.php.

Filters the sort keys of the customer list, as orderby key => column.

Use it together with manage_{screen_id}_sortable_columns to sort on a column of your own. The column must be one of the customer lookup columns (c.customer_id, c.user_id, c.username, c.first_name, c.last_name, c.email, c.date_last_active, c.date_registered, c.country, c.postcode, c.city, c.state) or an aggregate (display_name, orders_count, total_spent, date_last_order). Anything else is ignored, so no free SQL reaches the query. Built-in keys always stay.

ArgumentTypeDescription
$sortsarray<string, string>Column per orderby key.
add_filter( 'adba_customer_query_sorts', function ( $sorts ) {
	return $sorts;
} );

adba_customers_custom_column

ActionSince 1.3.0 Runs in src/Modules/Customers/CustomersTable.php.

Prints the content of a column added to the customer list through manage_{screen_id}_columns.

Echo escaped output, like manage_posts_custom_column.

ArgumentTypeDescription
$column_namestringColumn key.
$itemarray<string, mixed>Customer row: customer_id, user_id, name, email, orders_count, …
add_action( 'adba_customers_custom_column', function ( $column_name, $item ) {
	// ...
}, 10, 2 );

adba_order_block_changed

ActionSince 2.36.0 Runs in src/Modules/OrderBlock/OrderBlock.php.

Fires after a shop manager blocked or unblocked a customer.

ArgumentTypeDescription
$whoarray{user_id: int, emails: string[], reason: string}User id (0 for a guest), every blocked address and the internal reason.
$blockedboolTrue after blocking, false after unblocking.
add_action( 'adba_order_block_changed', function ( $who, $blocked ) {
	// ...
}, 10, 2 );

adba_order_block_is_blocked

FilterSince 2.36.0 Runs in src/Modules/OrderBlock/Guard.php.

Filters whether a customer is blocked from ordering. Return true to block on your own rule (an IP range, a domain), false to let a listed customer through.

ArgumentTypeDescription
$blockedboolWhether the customer is on the Addofy block list.
$whoarray{user_id: int, email: string}User id (0 for a guest) and lower case address.
add_filter( 'adba_order_block_is_blocked', function ( $blocked, $who ) {
	return $blocked;
}, 10, 2 );

adba_order_block_prevented

ActionSince 2.36.0 Runs in src/Modules/OrderBlock/Guard.php.

Fires when Addofy stopped a checkout of a blocked customer.

ArgumentTypeDescription
$whoarray{user_id: int, email: string}User id (0 for a guest) and lower case billing address.
add_action( 'adba_order_block_prevented', function ( $who ) {
	// ...
} );

adba_order_customer_card

FilterSince 1.3.0 Runs in src/Modules/Orders/CustomerCard.php.

Filters what the customer card on the order screen shows. Runs on every render, after the cache.

Keys: name, email, is_guest, orders_count (null when unknown), total_spent (null when unknown), last_order (Y-m-d H:i:s, empty when unknown), customer_url, user_url, orders_url (the order list of this customer). A value of another type than the built-in one is ignored. The same data fills the customer hover card in the order list.

ArgumentTypeDescription
$dataarray<string, mixed>Card data.
$order\WC_OrderOrder.
add_filter( 'adba_order_customer_card', function ( $data, $order ) {
	return $data;
}, 10, 2 );

adba_order_customer_card_after

ActionSince 1.3.0 Runs in templates/orders/customer-card.php.

Fires at the bottom of the customer card on the order screen.

ArgumentTypeDescription
$order\WC_OrderOrder.
$dataarray<string, mixed>Card data after adba_order_customer_card.
add_action( 'adba_order_customer_card_after', function ( $order, $data ) {
	// ...
}, 10, 2 );

adba_order_mobile_order

FilterSince 2.15.1 Runs in src/Modules/Orders/Orders.php.

Filters the order of the meta boxes on the order screen below 851px, where the two columns become one. The listed boxes come first, in this order; all others follow, the main column before the side column. Use it for the boxes of a plugin that belong with the order data. Only CSS changes, no box moves.

ArgumentTypeDescription
$idsstring[]Meta box ids, default order data, items and notes.
add_filter( 'adba_order_mobile_order', function ( $ids ) {
	return $ids;
} );

adba_order_quick_actions

FilterSince 1.2.0 Runs in src/Modules/OrderActions/QuickActionRegistry.php.

Filters the order quick actions. Add an object that implements AddoBack\Modules\OrderActions\QuickActionInterface to offer a new section in the popup.

ArgumentTypeDescription
$actionsQuickActionInterface[]Actions.
add_filter( 'adba_order_quick_actions', function ( $actions ) {
	return $actions;
} );

adba_order_status_choices

FilterSince 2.35.0 Runs in src/Modules/OrderActions/Actions/StatusAction.php.

Filters the order statuses that can be chosen in the status quick action and the palette's status command. Remove a status to keep it on the orders that have it while nobody can set it again, for example one that only marks imported orders. The order's own status is always added back, and the quick action refuses a status that is not in the list.

ArgumentTypeDescription
$statusesarray<string, string>Status name by slug (with the wc- prefix).
$order\WC_Order|nullOrder, or null in the palette before an order is chosen.
$contextstringquick_action (popup) or palette (command palette).
add_filter( 'adba_order_status_choices', function ( $statuses, $order, $context ) {
	return $statuses;
}, 10, 3 );

adba_order_unit_price_enabled

FilterSince 2.17.0 Runs in src/Modules/Orders/Orders.php.

Filters whether the order lines get a unit price field while they are edited.

ArgumentTypeDescription
$enabledboolWhether the Edit unit price setting is on.
$screenScreenCurrent screen.
add_filter( 'adba_order_unit_price_enabled', function ( $enabled, $screen ) {
	return $enabled;
}, 10, 2 );

Ready to connect your AI to real tools?

Start free trial