This recipe will offer code to mark a membership level as a trial which can only be used once. It’s useful for people looking to add a “no credit card required” trial option.
To start create a membership level for your trial and set an expiration date for it. Note the id of this level. Update the code below to set $trial_level_id (in all three functions) to that value. Then this code will add a custom user meta value when a user gains the trial level and then block that user from checking out with that level again.
It should be noted that this will only keep one USER from checking out again. You’ll have to get clever if you want to keep people from using a different email address to sign up again for the trial.
Adding the recipe to your website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.