In sales techniques, there is a way to make customers feel confident in the product, stimulating them to click the purchase button. That is to display the number of products sold. Displaying the sold quantity helps customers feel that this product is trusted, and they will quickly decide to buy.
It’s great that WooCommerce already counts the number of sold items for us. All you have to do is go outside the product page.
Show the number of products sold
First, we need to call the number of products sold out of the product page using the following code. You insert it into the child theme’s function.php file !
/**
* @author KenThan
* @description Product Sold Count
*/
add_action( 'woocommerce_single_product_summary', 'hocwordpress_product_sold_count', 11 );
function hocwordpress_product_sold_count() {
global $product;
$units_sold = $product->get_total_sales();
if ( $units_sold ){?>
<div class="product-sales epic_box">
<i class="fa fa-shopping-cart"></i>
<?php echo '' . sprintf( __( 'Đã bán: %s', 'woocommerce' ), $units_sold ) . '';
?>
</div><?php }
}
<div><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span>
Next, go to the Additional CSS section of the Flatsome theme, or the theme you are using, add the following CSS.
.epic_box {
padding-top: 5px;
border: 1px solid #ddd;
padding: 5px;
border-radius: 8px;
margin-bottom:10px;
}
.product-sales{
font-size:15px;
font-weight:600;
}
.product-sales .fa{
margin-right:10px;
}
<div>
<span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span>
</div>

Now go to the product page to check it out, as a result the quantity sold will be below the price of the product.

To increase the stimulation for customers, you can change the initial number to be more spectacular by the following way.
Go to the page to add a new or edit a product, click the options button displayed at the top, then turn on Custom Fields .

Now, you scroll down to see the Custom Fields table . In which there is the total_sales cell , you can change its value to the number you want.

The product now shows the number you entered. Every time a customer makes a purchase, woocommerce will automatically add to this number.

summary
Above is a guide to adding the number of products sold to the product page. This is to stimulate customers to buy more quickly. These are also quite simple, right? Good luck!

