Changing Avada WooCommerce Hooks
In general, the WooCommerce hook overrides used by Avada are stored in
class-avada-woocommerce.php in the
Avada/includes folder. To make the class object available, we have created a global variable for it called
$avada_woocommerce. This variable has to be used in order to remvoe any of the hooks that are defined in that class. It is defined in Avada’s
functions.php, so will be available once the theme is fully loaded. Thus you have to make sure you use the
wp WordPress hook when referencing
$avada_woocommerce. The next section will illustrate the correct setup.
Removing Avada WooCommerce Hooks
The following example function removes the add_product_border WooCommerce action from Avada. (This would remove the border from the product summary section on a single product page.) Notice, that we create a new function,
remove_woocommerce_hooks, so we are able to hook it to WP’s
after_setup_theme action. This ensures that we can access the needed
$avada_woocommerce variable, which we load using the PHP keyword
global. Now we can use that variable in the following removal function.
If you want to remove several hooks, you can add all the removal functions inside the wrapping
A list of all available hooks, functions that use them and their corresponding priorities can be found in the list below.
Replacing Avada WooCommerce Hooks
The following example function replaces the add_product_border WooCommerce action with add_my_product_border function. Since we consider the case of replacement here, we assume that you have already removed the hooks in question, in the way that was described in the last section. Now, to add your own replacements, you don’t have to use a wrapping function or the global
avada_woocommerce variable. You can directly hook your own function to the desired action or filter.