WooCommerce Marketing Trick: Check If User Already Purchased Product

Online marketing moves at the speed of light. To keep up, you need to be relentlessly creative. — Quick Sprout

You can use this little “tactic” for marketing (i.e. “Show- Buy More of This!”) or show special notices on the loop or single product page to motivate customers to buy the same item again.

Add below code in your function.php file:

Where to add this code?

You can place PHP snippets at the bottom of your functions.php file, We recommend to use child them so you will not lose any changes when updating your theme

Please Note- when a customer makes a purchase they must have to be logged in for this to work. well- how do you know what user it is if they’re not logged in? Unfortunately, there is no other easy way around it.

Did this snippet work?

Please let us know in the comments if snippet worked as expected. We would be happy to revise the code if you report otherwise or in case you need more assistance.


  1. Hi – how to add some text if the customer HASN’T bought the product – I need to display TWO messages depending on if they have purchased or not.


    • Hi Keely, It depends on where and what you want to show you can do something basic with if else statement in your page template… such as

      <?php if (is_user_logged_in()){ ?>
      <p>you are logged in</p>

      <?php } else { ?>
      <p>log-in please</p>

      <?php }; ?>

Leave a Reply

Your email address will not be published. Required fields are marked *