Expanding WooMex
Note: This is developer-level documentation. As part of our support policy, we cannot provide support for adjustments unless they have been commissioned through us. If you are unfamiliar with code / hooks and solving possible conflicts, contact us for help.
So that you can expand WooMex in important places, we offer various Hooks. In WordPress, hooks essentially allow you to change or add code without having to edit the files in the WooMex plugin. This also guarantees that individual adjustments are not overwritten when WooMex is updated. Hooks are used extensively in WordPress & WooMex and are therefore very useful for developers.
There are two types of hooks: Actions & Filters
- Action\ hooks allow you to insert custom code in different places (wherever the hook is running)
- **Filter hooks allow you to manipulate and return passed variables and their values (such as a list of functions).
A list of all hooks offered by WooMex can be found here (/en/products/woomex/developers/woomex-hooks/).
If necessary, we can supplement corresponding hooks. Just talk to us about that.
Use hooks
Section titled “Use hooks”If you want to use a hook to add or edit code, you can add your custom code in several ways:
- In the functions.php file of a custom Child-Theme
- With a plugin such as Code Snippets
Use action hooks
Section titled “Use action hooks”To run your own code in a special place in WooMex, you need to use an action hook (do\ action):
add_action( 'action_name', 'action_name_action' );function action_name_action() { // Your code}Note: An action hook is intended solely for executing code at a specific location in WooMex! A return value is not possible.
Use filter hooks
Section titled “Use filter hooks”To adjust values in a specific location of WooMex by your code, you must use a filter hook (apply\ filters):
add_filter( 'filter_name', 'filter_filter_name' );function filter_filter_name( $variable ) { // Your code return $variable;}Note: A filter hook must always return a value which must be of the same type as the transmitted type of the 1st attribute.