This code calculates and displays the percentage of sale orders out of total orders. WC() is a WordPress function that grabs the sales statistics from the WordPress database. get_total_sales() and get_total_orders() are used to get the total sales and orders respectively. The sale percentage is calculated by dividing the total sales by the total orders and multiplying the result by 100. Finally, the sale percentage is echoed to the screen.
Was this code snippet helpful?
YesNo