• Hi team,

    I have realized that the value returned from $product->get_total_sales() is different from the value shown when viewing sales per product reports (WooCommerce > Reports > Sales by product). At the moment, some products are returning zero sales while their reports show they have been sold multiple times.

    Here is a screenshot from the WooCommerce Reports page for a particular product: https://prnt.sc/te6z5j

    Here is a screenshot showing the sales number for the same product (added via hook): https://prnt.sc/te6yj6

    Code used:
    global $product;
    $units_sold = $product->get_total_sales();
    echo ‘’ . sprintf( __( ‘Units Sold: %s’, ‘woocommerce’ ), $units_sold ) . ‘
    ’;

  • The topic ‘Wrong Sales Data Being Reported’ is closed to new replies.