November 7, 2023

Show the WooCommerce Product Sold Count with Code Snippets

Play Video

Displaying the WooCommerce Product Sold Count on your product pages can be a great way to showcase the popularity of your items. This tutorial will walk you through the process of adding a simple code snippet to your WordPress site to achieve this functionality.


Please make sure you have the following installed and activated:

Follow these steps to display the product sold count:

  1. Navigate to Snippet >Add New.
  2. Name your new snippet “Show Products Sold”.
  3. Copy the code below:
     * Snippet Name:	WooCommerce Show Number Of Units Sold On Product Page
     * Snippet Author:
    add_action( 'woocommerce_after_add_to_cart_button', 'ecommercehints_show_units_sold_product_page' );
    function ecommercehints_show_units_sold_product_page() {
        global $product;
        echo '<br>Units Sold: '. $product->get_total_sales();

    Source: Code Snippets

  4. Paste the copied code into your new snippet.
    WooCommerce Product Sold Count Code
  5. Save changes and Activate the snippet.

Now, when you visit a product page, the number of units sold will be displayed.

Number of units sold will be displayed

WooCommerce Product Sold Count – Conclusion

With just a few steps, you’ve successfully added a feature to your WooCommerce store that highlights the sales success of your products. This not only informs potential customers about popular items but can also encourage more sales by showcasing the demand for your products.

Required Resources

WooCommerce Logo
Free Options
Code Snippets Logo
Free Options
Credit to Web Squadron
Web Squadron is a popular YouTube channel dedicated to providing informative tutorials, tips, and insights on web development and design. With a strong focus on WordPress and website builders like Bricks Builder, the channel aims to help users of all skill levels, from beginners to advanced developers, create and optimize their websites. By offering easy-to-understand, step-by-step guidance, Web Squadron provides practical and valuable content.
Show the WooCommerce Product Sold Count with Code Snippets
Welcome back!
Enter your Helwp credentials to sign in.

No Account yet? Sign Up

My Account
Give Feedback
Describe your feedback *
Rate Helwp
Problem *
Describe the problem
Want us to reply?
Your E-Mail
Affiliate Disclosure

At Helwp, we’re committed to transparency and honesty. Therefore, we want to inform you that some of the links on our website are affiliate links. This means that, at no additional cost to you, we may earn a small commission if you click through and make a purchase.

We only promote products or services that we genuinely believe in. These affiliate commissions help us to maintain the website and continue to provide you with free, high-quality WordPress content.

If you are interested in how you can support us even further, check out our support page.