Discover in this tutorial how to display the total revenue generated with Easy Digital Downloads (EDD) using a shortcode.
If you or any of your clients have an online business created with Easy Digital Downloads and are an Open Metrics lover, this will surely interest you.
In this tutorial you are going to learn how to show the number of total revenue you have achieved with EDD always updated wherever you want on the web.
Here’s how to do it:
Instructions to create a shortcode to display the number of total revenue generated with EDD
1. Create the shorcode
Add the following code at the end of functions.php or in your functionality plugin:
In this code you make a loop of the downloads created with Easy Digital Downloads and use the
edd_get_download_earnings_stats function to get the revenue of each one and add them up.
2. Insert the shortcode where you want it
Finally, just type
[edd_earnings] where you want it to be displayed.
- If you are using the classic editor, use the HTML tab to enter the shortcode.
- In case you are already using the WordPress block editor you can add it to the normal paragraph block, the HTML block or the shortcode block. All of them will render the content correctly.
Now you know how to show the revenue generated with Easy Digital Downloads and always keep it updated at any point of the website using a shortcode.
Even if you are not going to use this snippet to show the data publicly, it can be useful to create a dashboard where you can add all the relevant data of your business.
In addition, with small variations you can customize it to fit 100% to your needs.
Now you just have to put it into practice. 😉
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉