Offering new customers a unique incentive is a strong way to convert new shoppers. But how do you prevent these discount banners from being shown to your existing, previous customers?
In this code tutorial, I show you two methods to hide your Sitewide Sale banner for previous customers in EDD. First, there is code to check for a specific purchase, by download ID, for the current logged in user. The second section is a general check whether the current user has made any purchases at all through EDD.
The Code Recipe
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. We have a post on how to create a customizations plugin on our partner website, Paid Memberships Pro.
Modify line 15 for your specific download IDs. If you need to check for more than one product ID, you can duplicate lines 14-17 and set a unique product ID for each check. The function edd_has_user_purchased does not accept an array of IDs. Or, remove lines 14-17 if you only want to use the general check for any previous purchases.