# Recent Sales Widget for Easy Digital Downloads

> Lists the latest completed Easy Digital Downloads orders on the dashboard with customer email and amount.

- Type: PHP
- Runs: Admin only
- Category: [Dashboard](https://wpide.com/library/category/dashboard/)
- Requires: Easy Digital Downloads
- Tags: dashboard, widget, edd
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/edd-recent-sales-widget/

## Code

```php
add_action( 'wp_dashboard_setup', function () {
    if ( ! function_exists( 'edd_get_orders' ) || ! current_user_can( 'view_shop_reports' ) ) {
        return;
    }

    wp_add_dashboard_widget( 'wpide_edd_recent_sales', 'Recent Sales', function () {
        $orders = edd_get_orders( array(
            'number'  => 8,
            'status'  => array( 'complete' ),
            'type'    => 'sale',
            'orderby' => 'date_created',
            'order'   => 'DESC',
        ) );

        if ( ! $orders ) {
            echo '<p>No sales yet.</p>';
            return;
        }

        echo '<table class="widefat striped"><tbody>';
        foreach ( $orders as $order ) {
            printf(
                '<tr><td><a href="%1$s">#%2$s</a><br><small>%3$s</small></td><td style="text-align:right">%4$s<br><small>%5$s</small></td></tr>',
                esc_url( admin_url( 'edit.php?post_type=download&page=edd-payment-history&view=view-order-details&id=' . $order->id ) ),
                esc_html( $order->get_number() ),
                esc_html( $order->email ),
                esc_html( edd_currency_filter( edd_format_amount( $order->total ), $order->currency ) ),
                esc_html( human_time_diff( strtotime( $order->date_created ), time() ) . ' ago' )
            );
        }
        echo '</tbody></table>';
    } );
} );
```

## Notes

Needs Easy Digital Downloads 3.0 or newer.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Recent Sales Widget for Easy Digital Downloads" 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/
