1. Home
  2. Docs
  3. Local Delivery Drivers fo...
  4. Develop
  5. Developer Filters Reference – Local Delivery Drivers for WooCommerce Premium

Developer Filters Reference – Local Delivery Drivers for WooCommerce Premium

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 HookPurposeParameters (in order)Return Value
lddfw_driver_menuAdd/alter HTML in the driver-panel menu(string) $htmlModified HTML string
lddfw_driver_screenInject custom content for a custom lddfw_screen value(string) $htmlModified HTML string
lddfw_settings_tabsRegister extra tabs on the plugin settings page(array) $tabsUpdated tabs array
lddfw_assign_driver_permissionAllow/block assigning a driver to an order(bool) $allowed, (int) $driver_id, (WC_Order) $ordertrue or false
lddfw_set_order_commissionOverride or calculate the commission on an order(float) $commission, (int) $driver_id, (WC_Order) $orderNew commission float
lddfw_order_shipping_address_coordinatesFilter shipping-address geocode(array) $coords, (WC_Order) $order[ 'lat' => …, 'lng' => … ]
lddfw_get_driver_sellerAttach/modify a vendor ID for a driver`(int\false) $seller_id, (int) $driver_id`
lddfw_get_order_pickup_geocodeFilter pickup-location coordinates(array) $coords, (WC_Order) $orderCoordinate array
lddfw_pickup_typeChange pickup-type label (store, customer, etc.)(string) $type, (WC_Order) $orderLabel string
lddfw_pickup_phoneOverride pickup phone number(string) $phone, (WC_Order) $orderPhone string
lddfw_pickup_locationFilter the full pickup address string(string) $address, (WC_Order) $orderAddress string
lddfw_skip_order_itemExclude specific order items from driver view.$skip (bool, default false), $item_id (int), $item_data (WC_Order_Item), $order (WC_Order)bool — Return true to omit the item, false to display it.
lddfw_driver_order_page_infoInject additional HTML into the driver order page.$order (WC_Order)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.