Extending the customer screens and the order card
Addofy adds a customers list, a customer detail screen and a customer card on the order screen. This page shows the places where your plugin can add to them, and how template overrides work.
The customer list
The customer list is a normal list table.
- Add columns with
manage_woocommerce_page_adba-customers_columnsand print them onadba_customers_custom_column. - Sort on a column through
manage_woocommerce_page_adba-customers_sortable_columnsplusadba_customer_query_sorts. That filter only accepts customer lookup columns, so no free SQL gets in.
The customer detail screen
The detail screen has four actions:
adba_customer_detail_beforeadba_customer_detail_side, the card gridadba_customer_detail_mainadba_customer_detail_after
Print a card with AddoBack\Support\Components::card( $title, $html, $links ) to match the others.
The order screen
On the order screen, adba_order_customer_card filters the customer card data and adba_order_customer_card_after prints below it. In JavaScript, the filter adba.orderQuickActions (since 1.2.0) adds sections to the order quick actions popup. In PHP, a section implements Modules\OrderActions\QuickActionInterface.
Overriding templates
Addofy's screen templates (customers, the order customer card, the search page) can be overridden by a theme, like WooCommerce templates. Copy templates/customers/detail.php to {your-theme}/addoback/customers/detail.php. A child theme wins over its parent. The adba_template_path filter can point to another file. The settings and quick start templates cannot be overridden.
Every template has a @version line. Addofy > Tools lists the templates your theme overrides and marks the ones older than Addofy's copy, so an update never breaks a screen silently.
Prefer the actions inside the templates, for example adba_customer_detail_main, to add content. Override a template only when you need different markup, and keep its actions in your copy.
Related
- Customers and orders hooks
- Dark mode and color palettes: make your cards follow the theme.