Display number of products sold in Woocommerce.

Hiển thị số lượng sản phẩm đã bán trong Woocommerce

In sales techniques, showing the number of products sold can make customers feel more confident in the product, prompting them to make a purchase. WooCommerce can easily track the number of items sold for us. By adding a code to the function.php file in the child theme, we can display the number of products sold on the product page. Additionally, we can customize the display by changing the value in the Custom Fields section. This simple method can help stimulate customers to buy quickly. Displaying the number of products sold can create excitement and trust, increasing the likelihood of a purchase.

In sales techniques, it’s crucial to make customers feel confident about a product to encourage them to make a purchase. One effective way to do this is by showing the "number of products sold." When customers see that a product has been purchased by others, it creates a sense of trust and urgency that motivates them to buy.

The good news is that WooCommerce automatically tracks the number of items sold for us. To show the number of products sold, we need to access the product page and add a snippet of code to the functions.php file of the Child theme.

/** 
* @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 ){?>
<?php }
}

Next, you need to add some CSS styling to enhance the visual display of the product sales information. In the additional CSS section of the Flatsome theme or your current theme, insert the following CSS code:

.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;
}

After adding the necessary code, go back to the product page to see the result. The quantity sold will now be displayed below the price of the product, adding a layer of credibility and urgency for potential buyers.

See also  Guide to creating mobile interface for WordPress using WP Touch.

To further enhance customer excitement, you can customize the displayed number of sales. Simply access the product page, click on the display options button, enable Custom Fields, and navigate to the Custom Fields section to modify the total_sales value.

By following these steps, you can personalize the product sales display to attract more customers and drive purchase decisions. It’s a simple yet effective strategy to create a sense of trust and urgency in potential buyers. Remember, every time a customer makes a purchase, WooCommerce will automatically update the displayed sales number.

In summary, adding the number of products sold to the product page is a powerful technique to boost sales and instill confidence in potential buyers. It’s a simple process that can make a significant impact on customer decision-making. Good luck with implementing this strategy on your WordPress site!

5/5 - (1 vote)

Related posts