Coupon Affiliates

How can we help?

Search the documentation or ask the AI agent anything about the plugin.

Add custom columns to “Referred Orders” table (Function)

Updated September 15, 2026

This article is mirrored from couponaffiliates.com.

By default, the Referred Orders table in the affiliate dashboard shows a fixed set of columns like order date, status, and commission.

If you’d like to display additional information – such as a custom field collected at checkout – you can do that with a small snippet of code added to your theme’s functions.php file or a site-specific plugin.

No core files need to be edited, and the change will survive plugin updates.

Version 7.8.0+ of Coupon Affiliates is required.


How it works

You need two small code snippets:

  1. Register your column – this tells the table what heading to show.
  2. Provide the value – this tells the table what to display in that column for each order.

That’s it. Here’s a complete working example that adds a “Customer Note” column showing the note a customer left at checkout:

// Step 1 - Register the column heading
add_filter( 'wcusage_filter_referred_orders_custom_columns', function( $columns ) {
    $columns['customer_note'] = array(
        'label' => 'Customer Note',
    );
    return $columns;
}, 10, 1 );

// Step 2 - Display the value for each order row
add_filter( 'wcusage_filter_referred_orders_custom_column_value', function( $value, $column_key, $order ) {
    if ( 'customer_note' !== $column_key ) {
        return $value;
    }

    $note = $order->get_customer_note();

    return '' !== $note ? esc_html( $note ) : '—';
}, 10, 3 );

Showing a custom checkout field instead

If you collected a custom field during checkout and saved it as order meta, swap out $order->get_customer_note() for $order->get_meta() and pass in your field’s meta key. For example, if your field is saved as _delivery_date:

// Step 1 - Register the column heading
add_filter( 'wcusage_filter_referred_orders_custom_columns', function( $columns ) {
    $columns['delivery_date'] = array(
        'label' => 'Delivery Date',
    );
    return $columns;
}, 10, 1 );

// Step 2 - Display the value for each order row
add_filter( 'wcusage_filter_referred_orders_custom_column_value', function( $value, $column_key, $order ) {
    if ( 'delivery_date' !== $column_key ) {
        return $value;
    }

    $date = $order->get_meta( '_delivery_date' );

    return '' !== $date ? esc_html( $date ) : '—';
}, 10, 3 );

Not sure what your field’s meta key is? You can usually find it by checking your checkout plugin’s settings, or by looking at the order details in WooCommerce > Orders using a plugin like WP Meta Inspector.


Adding multiple columns at once

You can register as many columns as you like in a single snippet. Just add extra lines to Step 1, and handle each one in Step 2:

// Step 1 - Register multiple column headings
add_filter( 'wcusage_filter_referred_orders_custom_columns', function( $columns ) {
    $columns['delivery_date']  = array( 'label' => 'Delivery Date' );
    $columns['purchase_order'] = array( 'label' => 'Purchase Order #' );
    return $columns;
}, 10, 1 );

// Step 2 - Display the value for each column
add_filter( 'wcusage_filter_referred_orders_custom_column_value', function( $value, $column_key, $order ) {
    switch ( $column_key ) {
        case 'delivery_date':
            $v = $order->get_meta( '_delivery_date' );
            return $v ? esc_html( $v ) : '—';

        case 'purchase_order':
            $v = $order->get_meta( '_purchase_order_number' );
            return $v ? esc_html( $v ) : '—';
    }
    return $value;
}, 10, 3 );

Was this article helpful?