Overview
The User Switching plugin is a fantastic free plugin that allows you to swap to any user account on your site. When this plugin is active on your site while Memberships is activated, a User Switching integration will let you impersonate members to test out your restriction and discount rules.
How it Works
The Memberships integration with User Switching creates a temporary user account on your site with the appropriate membership access. You’re signed into this account so that you can completely simulate the membership account for testing.
If you log out of this account and log back into your own, the temporary account and membership will still exist. When you click “Switch back” from either the meta widget or the admin bar, the temporary membership and user account are completely destroyed from your site and database so you don’t have to worry about testing accounts lying around on your site or deleting them when you’re finished.
Usage
Before using this integration to test a membership plan, we recommend that you add the WordPress “Meta” widget to your sitebar or footer temporarily while testing. This will allow you to easily switch back to your user account from the temporary member testing account.
If your site is live, you can also note that the admin toolbar will be forced at the top of the page, which will let you switch back easily as well (only in Memberships version 1.1+).
To start testing a membership, you’ll need to go to WooCommerce > Memberships > Membership Plans. When the User Switching plugin is active, a new action is available while viewing your membership plans — “View site as member”:
This action will allow you to view the site as a member of the selected plan so you can test your restriction and discount rules. When you opt to view the site as a member, you’ll be directed to the “My Account” page and logged into the testing account:
You can now browse your site content as a member. For example, restricted content will now be accessible to you if available, or you may see delayed content messages if you don’t grant access to content immediately:
You’ll also see member discounts applied on your products, and discount notices disabled (if you have them enabled under WooCommerce > Settings > Memberships > Products):
When you’re done with testing, you can click the “Switch back” link in the meta widget or from the admin toolbar to destroy the test user and log back into your account.