The View as Customer plugin includes developer hooks to customize the switching behavior.
Below are optional code snippets that developers can use to modify the redirect URL after switching into a customer account.
Use the vac_after_switch_redirect_url filter to override the redirect URL.
add_filter( 'vac_after_switch_redirect_url', function( $url, $user_id ) {
return site_url( '/shop/' ); // Redirect to Shop
}, 10, 2 );
| Parameter | Description |
|---|---|
$url | The original redirect URL |
$user_id | The customer ID being switched to |
📍 Usage
Add this snippet to your theme’s functions.php file or a custom plugin.