Add sale count next to star rating in woocommerce single product page

Question

I am trying to add order, sale count next to star rating at single product page, my store is build with wordpress and woocommerce, i have tried a code but it add this function before add to cart button/form. website url for referrence: https://techcart.pk and image https://i.stack.imgur.com/TLeip.jpg

add_action( 'woocommerce_before_add_to_cart_button', 'product_sold_count', 10 );
  function product_sold_count() {
   global $product;
   $units_sold = $product->get_total_sales();
   if ( $units_sold ) echo '<p>' . sprintf( __( 'Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';

I will appreciate if any one help me in this matter.

0
, , Asif Mughal 1 year 2020-07-20T12:10:27-05:00 0 Answers 23 views 0

Leave an answer

Browse
Browse