# Notify Extra People of EDD Sales by Category

> Adds extra recipients to the Easy Digital Downloads sale notification when an order contains downloads from a category, such as a partner or course author.

- Type: PHP
- Runs: Run everywhere
- Category: [Easy Digital Downloads](https://wpide.com/library/category/edd/)
- Requires: Easy Digital Downloads
- Tags: edd, email, notifications, categories
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/edd-sale-notice-by-category/

## Code

```php
$wpide_edd_category_emails = array( // Download category slug => email address.
    'themes'  => 'designer@example.com',
    'courses' => 'teacher@example.com',
);

add_filter( 'edd_admin_notice_emails', function ( $emails, $email = null ) use ( $wpide_edd_category_emails ) {
    $order_id = ( $email instanceof \EDD\Orders\Order ) ? (int) $email->id : 0; // EDD passes the order for sale notifications.

    if ( ! $order_id || ! function_exists( 'edd_get_order_items' ) ) {
        return $emails;
    }

    foreach ( edd_get_order_items( array( 'order_id' => $order_id, 'number' => 100 ) ) as $item ) {
        foreach ( $wpide_edd_category_emails as $slug => $address ) {
            if ( is_email( $address ) && has_term( $slug, 'download_category', $item->product_id ) ) {
                $emails[] = $address;
            }
        }
    }

    return array_values( array_unique( (array) $emails ) );
}, 10, 2 );
```

## Notes

The usual sale notification recipients still get every email.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Notify Extra People of EDD Sales by Category" 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/
