# EDD Purchases and Lifetime Value in the Users List

> Adds "Purchases" and "Lifetime value" columns to Users > All Users from Easy Digital Downloads customer records, so you can spot your best buyers.

- Type: PHP
- Runs: Admin only
- Category: [Easy Digital Downloads](https://wpide.com/library/category/edd/)
- Requires: Easy Digital Downloads
- Tags: edd, users, customers, columns
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/edd-users-spent-column/

## Code

```php
add_filter( 'manage_users_columns', function ( $columns ) {
    $columns['wpide_edd_purchases'] = 'Purchases';
    $columns['wpide_edd_value']     = 'Lifetime value';

    return $columns;
} );

add_filter( 'manage_users_custom_column', function ( $value, $column, $user_id ) {
    if ( 'wpide_edd_purchases' !== $column && 'wpide_edd_value' !== $column ) {
        return $value;
    }

    $customer = function_exists( 'edd_get_customer_by' ) ? edd_get_customer_by( 'user_id', $user_id ) : false;

    if ( ! $customer ) {
        return '–';
    }

    if ( 'wpide_edd_purchases' === $column ) {
        return sprintf( '<a href="%1$s">%2$d</a>', esc_url( admin_url( 'edit.php?post_type=download&page=edd-customers&view=overview&id=' . $customer->id ) ), (int) $customer->purchase_count );
    }

    return esc_html( html_entity_decode( edd_currency_filter( edd_format_amount( $customer->purchase_value ) ) ) );
}, 10, 3 );
```

## Notes

Users without an EDD customer record show a dash.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "EDD Purchases and Lifetime Value in the Users List" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
