|

Get Woocommerce product sale amount

To get woocommerce product sale amount , you can use this shortcode

add_shortcode( 'sales', 'show_sales_by_product_id' );
   
function show_sales_by_product_id( $atts ) {
        
   $atts = shortcode_atts( array(
      'id' => ''
   ), $atts );
    
   $units_sold = get_post_meta( $atts['id'], 'total_sales', true );
     
   return $units_sold;
     
}

Similar Posts

Leave a Reply

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