WooCommerce Hooks Actions & Filters

In this post I’m going to show how to use WooCommerce Hooks actions & filters for core plugin customization.  Hooks are of two types Action and Filter. Hooks are snippets of code that can be placed into your WordPress theme’s functions.php file or even added into a custom plugin.

Action Hooks

Action hooks are triggered when an event takes place, such as a user logged in or a custom action that you define in your theme or plugin.

 

We can create our own custom action hooks within plugin or theme using do_action() function. The function hooked to that action will run at that point in the code.

 

Filter Hooks

Filter Hooks are used to modify data at runtime. The main difference between Action and Filter hook is, Filter Hook always returns a modified data value while Action Hook just triggers the code at that point in the code.

 

The apply_filter() functions apply filter to the the existing code. Later we can modify that code via add_filter() function.

For WooCommerce Core Customization please check my post Best WooCommerce Customization Practices

WooCommerce Hooks Actions & Filters Reference

WordPress Hooks: Actions and Filters

Your one social media share will help others

Leave a Comment