Hide Sale Banners for Previous Customers in Easy Digital Downloads

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.

Hide Sale Banners for Previous Customers in Easy Digital Downloads

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.

SHARE YOUR LOVE
Kim Coleman
Kim Coleman

Hi! I'm Kim Coleman, an internet entrepreneur from Reading, PA. I've been working with WordPress for over 15 years. In 2011, I founded Paid Memberships Pro, a complete plugin for Recurring Subscriptions and Content Restriction with 100k active sites. I'm currently working on our new product, Sitewide Sales.

Articles: 35