Hooks are mighty in WordPress. They allow you to extend an existing function, which allows you to modify WordPress’ core functionality without editing original files.
I have compiled useful WooCommerce hooks which might save you some development time, here you go:
Hide Account Menu Items
To create a Custom WooCommerce Email
WooCommerce comes with various email templates and it also provides you with a way to create your own emails which are going to be sent on some events. You can use following hook to register a custom WooCommerce Email.
Implementation of custom email is divided into three phases:
1. Extending WC_Email class to define the email header, subject, email template for content, etc.
2. Adding our custom email class to the default WooCommerce email classes using woocommerce_email_classes filter
3. Creating our own email template to be used to generate email content for our custom email.
Note: Mk_Custom_Mail_Class php class must inherit WC_Emails class which is present in woocommerce/includes/emails/class-wc-email.php.
Remove the default WooCommerce emails
Following snippet allows you to unhook and remove the default WooCommerce emails.
Update WooCommerce Order Date on Status Change Events
‘woocommerce_order_status_changed‘ event triggers when there is a change in order status whether manual or automatic.
Display Custom Woocommerce Order Data
‘woocommerce_admin_order_data_after_order_details’ hook can be used to display additional information within order details.
Remove Line Item Link
Using following snippet you can disable link under line item meta table.
How to Use Hooks on Your Woocommerce
Unless you’re writing a plug-in, you would write hooks in the functions.php file. This file is located in the wp-content/themes/your-theme directory.
WooCommerce Hooks Guide
For details on what the action hooks and filters do, reference the WooCommerce Hooks Reference.
Thank you for reading my post. I intend to update the list of hooks time to time.