Below is the full reference for filter hooks exposed by Local Delivery Drivers for WooCommerce Premium. Each entry lists the hook, its purpose, arguments (in order), and the value you should return. Use add_filter() in your own plugin or theme and remember to escape output properly.
| Filter Hook | Purpose | Parameters (in order) | Return Value |
|---|---|---|---|
lddfw_driver_menu | Add/alter HTML in the driver-panel menu | (string) $html | Modified HTML string |
lddfw_driver_screen | Inject custom content for a custom lddfw_screen value | (string) $html | Modified HTML string |
lddfw_settings_tabs | Register extra tabs on the plugin settings page | (array) $tabs | Updated tabs array |
lddfw_assign_driver_permission | Allow/block assigning a driver to an order | (bool) $allowed, (int) $driver_id, (WC_Order) $order | true or false |
lddfw_set_order_commission | Override or calculate the commission on an order | (float) $commission, (int) $driver_id, (WC_Order) $order | New commission float |
lddfw_order_shipping_address_coordinates | Filter shipping-address geocode | (array) $coords, (WC_Order) $order | [ 'lat' => …, 'lng' => … ] |
lddfw_get_driver_seller | Attach/modify a vendor ID for a driver | `(int\ | false) $seller_id, (int) $driver_id` |
lddfw_get_order_pickup_geocode | Filter pickup-location coordinates | (array) $coords, (WC_Order) $order | Coordinate array |
lddfw_pickup_type | Change pickup-type label (store, customer, etc.) | (string) $type, (WC_Order) $order | Label string |
lddfw_pickup_phone | Override pickup phone number | (string) $phone, (WC_Order) $order | Phone string |
lddfw_pickup_location | Filter the full pickup address string | (string) $address, (WC_Order) $order | Address string |
lddfw_skip_order_item | Exclude specific order items from driver view. | | bool — Return true to omit the item, false to display it. |
lddfw_driver_order_page_info | Inject additional HTML into the driver order page. | | string — HTML markup appended to the existing order info block. |
Example 1 – Add a “Payment History” Link to the Driver Menu
add_filter( 'lddfw_driver_menu', function ( $html ) {
$html .= '<div class="dropdown-divider"></div>';
$html .= '<a class="dropdown-item lddfw_loader lddfw_loader_fixed" href="' .
lddfw_drivers_page_url( 'lddfw_screen=payment_history' ) . '">' .
esc_html__( 'Payment History', 'my-plugin' ) . '</a>';
return $html;
}, 99 );
Example 2 – Custom Driver Screen (Payment History)
add_filter( 'lddfw_driver_screen', function ( $html ) {
global $lddfw_screen;
if ( 'payment_history' !== $lddfw_screen ) {
return $html;
}
$screen = new LDDFW_Screens();
$back_url = lddfw_drivers_page_url( 'lddfw_screen=dashboard' );
$output = $screen->lddfw_header( __( 'Payment History', 'my-plugin' ), $back_url );
$output .= '<div class="container lddfw_page_content"><p>' .
esc_html__( 'Coming soon…', 'my-plugin' ) .
'</p></div>';
return $output . $screen->lddfw_footer();
}, 99 );
Example 3 – Add a Custom Settings Tab
add_filter( 'lddfw_settings_tabs', function ( $tabs ) {
$tabs['my_custom_tab'] = __( 'My Add-on', 'my-plugin' );
return $tabs;
} );
Example 4 – Prevent Assignment If Driver Exceeds Daily Limit
add_filter( 'lddfw_assign_driver_permission', function ( $allowed, $driver_id ) {
$daily_limit = 30;
$current = lddfw_get_driver_orders_count( $driver_id );
return ( $current >= $daily_limit ) ? false : $allowed;
}, 10, 2 );
Example 5 – Custom Commission Calculation (Time + Distance)
add_filter( 'lddfw_set_order_commission', function ( $commission, $driver_id, $order ) {
$distance = (float) $order->get_meta( '_lddfw_distance_km' );
$minutes = (float) $order->get_meta( '_lddfw_travel_time_min' );
return round( ( $distance * 0.8 ) + ( $minutes * 0.2 ), 2 );
}, 10, 3 );
Developer Tips
- Escape dynamic output with
esc_html(),esc_url(), etc. - Keep callbacks lightweight; the driver UI runs on mobile devices.
- Enqueue extra scripts or styles only on the pages where they’re needed.