# Redirect an Empty EDD Checkout to Your Products

> Sends visitors who land on the Easy Digital Downloads checkout with an empty cart to your products page instead of showing "Your cart is empty".

- Type: PHP
- Runs: Run everywhere
- Category: [Easy Digital Downloads](https://wpide.com/library/category/edd/)
- Requires: Easy Digital Downloads
- Tags: edd, checkout, cart, redirects
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/edd-empty-checkout-redirect/

## Code

```php
$wpide_edd_shop_url = ''; // Empty uses the downloads archive, or the home page if there is none.

add_action( 'template_redirect', function () use ( $wpide_edd_shop_url ) {
    if ( ! function_exists( 'edd_is_checkout' ) || ! edd_is_checkout() || edd_get_cart_contents() || isset( $_GET['payment-confirmation'] ) || isset( $_GET['edd-listener'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
        return;
    }

    $url = $wpide_edd_shop_url ? $wpide_edd_shop_url : get_post_type_archive_link( 'download' );

    wp_safe_redirect( $url ? $url : home_url( '/' ) );
    exit;
} );
```

## Notes

Set $wpide_edd_shop_url to your products page; receipts and payment confirmation pages are not affected.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Redirect an Empty EDD Checkout to Your Products" 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/
