Duplicate Snippet
Embed Snippet on Your Site
MemberPress: Restrict Purchase of a Specific Membership Based on Existing Subscriptions
This code snippet restricts the purchase of a specified MemberPress membership (restricted membership), based on a user's existing active memberships. While on the MemberPress account page, a user won’t be allowed to purchase a membership if there is an active subscription to any of the memberships specified in the code (allowed memberships).
The sample code will prevent a user from purchasing the restricted membership with the ID of 789 if that user is already subscribed to one of the allowed memberships, either with the ID of 123 or 456.
To change the Restricted membership, replace the 789 dummy ID with the actual membership ID.
Code Preview
php
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments