WooCommerce: Notify the customer if they have bought a product before

In an online store, any customization that reminds us that we are regular customers is very important, and something you will have seen in the kings of ECommerce, such as Amazon, is that if you are seeing products that you have already bought, it informs you about it.

And this is something you can also incorporate into your WooCommerce online store.

You only have to add this simple function at the end of the functions.php file of the active child theme, or if you prefer it in a plugin with your customizations, it works anyway:

/* Already purchased this product */ add_action( 'woocommerce_after_shop_loop_item', 'wphelp_you_already_bought_this', 30 ); function wphelp_you_already_bought_this() { global $product; if ( ! is_user_logged_in() ) return; $current_user = wp_get_current_user(); if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product->get_id() ) ) echo '<div class="user-bought">&hearts; Hello ' . $current_user->first_name . ', you already bought this! Are you interested on it again?</div>'; }
Code language: PHP (php)

You only have to customize – if you want – the text to be shown to the user and save the changes.

What you will have is a friendly message to your regular customers (who are online, otherwise there is no way for them to know what they have bought) if there are products they have already bought.

This has several advantages in your sales funnel:

  • The customer is recognized, and that’s always nice.
  • The customer sees that there is artificial intelligence in your E-commerce, and that gives them a plus of professionalism.
  • You can encourage the customer to buy a product again, especially if it is a regular supply.
  • You can encourage the customer to take a look at other types of products, different from the ones they already bought.

Of course, it depends on how you use the text to be displayed will have more or less impact, it always adds

Read this post in Spanish: WooCommerce: Avisar al cliente si ya ha comprado antes un producto

Click to rate this post!
[Total: 0 Average: 0]

Leave a Comment

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

Scroll to Top Skip to content