In WooCommerce, if you go to System Status > Tools you can see a list of useful default tools such as “Clear Transients”, “Recount Terms”, or “Install WooCommerce Pages”.
But do you know that you can create your own custom buttons there? It can be very useful when you create a plugin that needs advanced tools.
In the code below you’ll see that adding a button linked to a custom action is pretty easy. To make the code easier to test, I embed the code in a plugin.
The idea is to register a new button using a hook (filter) called woocommerce_debug_tools and then create the callback function that will be triggered when the button is clicked.
The function called debug_button_action() will be where you will have to create custom coding. You can for example send an email, delete en option, create content etc… just be creative!
That’s it! Simple and useful right?