Hi there,
I am not sure that I completely understand your question here. Can you please clarify a little further exactly what you are looking to achieve regarding your monthly revenue and what you are referring to when you say, “store it in a variable”?
Thanks
i need to print this variable in fronted for example
i want to print the revenue for each month in frontend
Hi there,
The built-in WooCommerce Reports have an Export CSV link that you can use to download your data for further analysis in a spreadsheet.
You can see this by going to WooCommerce> Reports> Orders> Sales by Date> This month and then export the CSV to print.
Best,
Thank you Amanda
But i need to display the “total of revenue” as a number in frontend not in the dashboard
i need a codex help to get total revenue for each month
Hi there,
It’ll definitely take some custom work, but perhaps take a look at how reports are built in WooCommerce core. I bet a lot of the same functions could be re-used to get the data you need.
From there outputting it on the front end depends on if you’re wanting to graph the data, etc… There are lots of libraries for that, but again it likely takes a lot of elbow grease to make happen. 🙂
Thank you Ryarnr14
i just need to display the total revenue as a number
add a month and year to the function and return the total number of renenue
Hey @sal4sup – perhaps you can use something like this as a starting point:
https://gist.github.com/tommyshellberg/b30b65c30a9f2c409ec0feddf85dca17
It’s super rudimentary but it takes the last 30 days of sales data and displays it wherever the [display_monthly_sales] shortcode is used.
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.