# Send Customers to the Shop After Login

> Takes customers to the shop page after they log in or register through WooCommerce, instead of the My Account dashboard.

- Type: PHP
- Runs: Run everywhere
- Category: [Redirects](https://wpide.com/library/category/redirects/)
- Requires: WooCommerce
- Tags: woocommerce, login, redirect
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-customers-to-shop-after-login/

## Code

```php
$wpide_customer_redirect = function ( $redirect, $user = null ) {
    $user = $user instanceof WP_User ? $user : wp_get_current_user();

    if ( ! $user || user_can( $user, 'edit_posts' ) || user_can( $user, 'manage_woocommerce' ) ) {
        return $redirect;
    }

    $shop = wc_get_page_permalink( 'shop' );

    return $shop ? $shop : $redirect;
};

add_filter( 'woocommerce_login_redirect', $wpide_customer_redirect, 20, 2 );
add_filter( 'woocommerce_registration_redirect', $wpide_customer_redirect, 20 );
```

## Notes

Shop managers and administrators keep the default destination.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Send Customers to the Shop After Login" 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/
