Override Avada WooCommerce Hooks
Last Update: April 16, 2024
What Are Avada WooCommerce Hooks?
Avada uses different hooks (actions and filters) that WooCommerce offers to change styling and to extend the functionality of certain components. Any of Avada’s WooCommerce hooks can be replaced with your own, which allows you to override both, WooCommerce and Avada native behaviour.
For more information about the general concept of action and filters in WordPress, please see the links below:
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 remove 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 remove_woocommerce_hooks
function.
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.
Avada WooCommerce Hooks
Avada WooCommerce Actions
Below is a list of Avada WooCommerce actions that can be removed or replaced with your own action.
Summary border on a single product page.
Product title on a single product page.
Show details button on a single product page.
Product stock HTML on a single product page.
Social icons below product description on a single product page.
Related products on a single product page.
Upsell products on a single product page.
Sidebar on WooCommerce page.
Welcome bar to checkout page.
Proceed to checkout button.
View order form on my account page.
Thank you message on my account page.