Display Total Product Sold Quantity to WooCommerce Product Page

# This is post #4 of 31 in the challenge “Mastering WooCommerce

This snippet code show you how to display total product sold quantity under product title at WooCommerce product page.

Currently your customers have no idea how many quantity or downloads have been ordered from your WooCommerce site. So in order to apply this change, you can add below code into your theme functions.php.

function tt_show_product_loop_unitsold() {
  global $product;
  $units_sold = get_post_meta( $product->id, 'total_sales', true );

  echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>'; //you can change text Units Sold to any text liked Total Downloads
}

add_action( 'woocommerce_single_product_summary',  'tt_show_product_loop_unitsold', 8 );
WooCommerce Product Quanity Sold at Product Page
WooCommerce Product Quanity Sold at Product Page

9 thoughts on “Display Total Product Sold Quantity to WooCommerce Product Page”

  1. Pingback: Challenge List : 31 Ways to Customize WooCommerce | Terry Tsang : PHP Developer and Wordpress Consultant

  2. hi

    2 questions
    – how to display for only “one product” example: id=243
    – how to display only product solds over 10 item?

    thanks

Leave a Comment

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