Buy All 47 Premium Themes For the Price Of $199.99

How to Add a Custom “Recently Purchased by Others” Message in WooCommerce Using Hooks

Social proof is one of the strongest psychological triggers in eCommerce.
Showing that other customers recently bought a product increases trust and encourages new purchases.

In this tutorial, you will learn how to display a dynamic “recently purchased” message in WooCommerce using hooks.

Why Social Proof Works

When shoppers see that other people are buying a product, it reduces hesitation and builds confidence.

  • Builds trust instantly
  • Creates urgency and demand
  • Increases conversion rates
  • Makes products feel more popular

The WooCommerce Hook We Will Use

We will use:

woocommerce_single_product_summary

This hook allows us to insert content into the product page summary section.

Example Code

Add this code to your theme’s functions.php file or a custom plugin:


add_action('woocommerce_single_product_summary', 'recent_purchase_social_proof', 20);

function recent_purchase_social_proof() {

    global $product;

    if (!$product) {
        return;
    }

    $messages = array(
        'Someone just bought this item 2 minutes ago',
        '5 people purchased this product today',
        'This product is trending right now',
        'High demand item — selling fast'
    );

    $message = $messages[array_rand($messages)];

    echo '

'; echo ' ' . esc_html($message) . ''; echo '

'; }

How It Works

  • The function runs on the product page
  • It randomly selects a social proof message
  • It displays the message under product details

Customization Ideas

  • Connect to real order data instead of random messages
  • Show location-based purchases
  • Add countdown urgency messages
  • Display live purchase notifications