WooCommerce Hooks: List and Examples

Updated: October 01, 2021

Share:

With a view to helping developers make it easier to change or adding the code on your WooCommerce store, WooCommerce offers users multiple hooks.

So, what are WooCommerce hooks? List of them? And examples of these hooks in WooCommerce stores?

All will be clarified in this post!

Table of contents

What are WooCommerce hooks?

WooCommerce hook is a powerful tool for developers that empowers them to add new codes or change the existing ones without editing the core files.

In fact, these hooks can be generally divided into two types which are actions and filters. Action hooks allow users to insert custom code at different points as long as the hook is run there. Meanwhile, the filter ones include the hooks that enable developers to manipulate and return a variable that passes.

Example of hooks

List of WooCommerce hooks

In WooCommerce, there are various hooks that may confuse you when looking at first, so we categorize them into different types so that you can understand them more rapidly.

Global hooks

  • woocommerce_breadcrumb
  • woocommerce_no_products_found
  • pre_get_product_search_form

    Cart hooks

Before product list:

  • woocommerce_before_cart
  • woocommerce_cart_contents
  • woocommerce_before_cart_table
  • woocommerce_before_cart_contents
  • woocommerce_after_cart_contents

After product list:

  • woocommerce_before_cart_totals
  • woocommerce_cart_actions
  • woocommerce_cart_coupon
  • woocommerce_cart_collaterals
  • woocommerce_after_cart_table

At the end of an order:

  • woocommerce_cart_coupon
  • woocommerce_cart_actions
  • woocommerce_cart_collaterals
  • woocommerce_after_cart_table
  • woocommerce_before_cart_totals

In an empty cart:

  • woocommerce_cart_is_empty

    Checkout hooks

Before contact form:

  • woocommerce_checkout_billing
  • woocommerce_before_checkout_form
  • woocommerce_before_checkout_billing_form
  • woocommerce_checkout_before_customer_details

To set markup for billing details:

  • woocommerce_before_order_notes
  • woocommerce_after_order_notes
  • woocommerce_checkout_shipping
  • woocommerce_after_checkout_billing_form
  • woocommerce_checkout_after_order_review

Before the product summary in the order:

  • woocommerce_review_order_before_shipping
  • woocommerce_review_order_after_shipping
  • woocommerce_checkout_before_order_review
  • woocommerce_review_order_before_order_total
  • woocommerce_review_order_after_order_total
  • woocommerce_review_order_before_cart_contents
  • woocommerce_review_order_after_cart_contents
  • woocommerce_checkout_after_customer_details

Below the order form:

  • woocommerce_after_checkout_form
  • woocommerce_checkout_order_review
  • woocommerce_review_order_before_submit
  • woocommerce_review_order_after_submit
  • woocommerce_review_order_before_payment
  • woocommerce_review_order_after_payment

In the product list of an order:

  • woocommerce_thankyou
  • woocommerce_order_items_table
  • woocommerce_order_item_meta_end
  • woocommerce_order_item_meta_start
  • woocommerce_order_details_after_order_table

    Product hooks

    At the top and bottom of the product page:

  • woocommerce_before_main_content
  • woocommerce_after_main_content
  • woocommerce_before_single_product
  • woocommerce_after_single_product

Above and below the product description:

  • woocommerce_before_single_product_summary
  • woocommerce_after_single_product_summary

In short product description:

  • woocommerce_share
  • woocommerce_product_meta_end
  • woocommerce_product_meta_start
  • woocommerce_single_product_summary

In the comments:

  • woocommerce_review_meta
  • woocommerce_review_before
  • woocommerce_review_comment_text
  • woocommerce_review_before_comment_text
  • woocommerce_review_after_comment_text
  • woocommerce_review_before_comment_meta

    Category hooks

  • woocommerce_shop_loop
  • woocommerce_before_shop_loop
  • woocommerce_after_shop_loop
  • woocommerce_after_shop_loop_item
  • woocommerce_shop_loop_item_title
  • woocommerce_before_shop_loop_item_title
  • woocommerce_after_shop_loop_item_title
  • woocommerce_archive_description

    My account hooks

  • woocommerce_account_content
  • woocommerce_account_navigation
  • woocommerce_before_account_navigation
  • woocommerce_after_account_navigation
  • woocommerce_before_edit_account_address_form
  • woocommerce_after_edit_account_address_form
  • woocommerce_before_my_account
  • woocommerce_after_my_account
  • woocommerce_account_dashboard

    Mini cart hooks

  • woocommerce_before_mini_cart
  • woocommerce_after_mini_cart
  • woocommerce_mini_cart_contents
  • woocommerce_before_mini_cart_contents
  • woocommerce_widget_shopping_cart_buttons
  • woocommerce_widget_shopping_cart_before_buttons

    Email hooks

  • woocommerce_email_footer
  • woocommerce_email_header
  • woocommerce_email_order_meta
  • woocommerce_email_order_details
  • woocommerce_email_customer_details
  • woocommerce_email_before_order_table
  • woocommerce_email_after_order_table

    Others

  • woocommerce_auth_page_header
  • woocommerce_auth_page_footer
  • woocommerce_available_download_start
  • woocommerce_available_download_end
  • woocommerce_before_available_downloads
  • woocommerce_after_available_downloads
  • woocommerce_before_account_downloads
  • woocommerce_after_account_downloads
  • woocommerce_before_account_orders
  • woocommerce_after_account_orders
  • woocommerce_before_account_orders_pagination
  • woocommerce_cart_has_errors
  • woocommerce_edit_account_form
  • woocommerce_edit_account_form_start
  • woocommerce_edit_account_form_end
  • woocommerce_before_edit_account_form
  • woocommerce_after_edit_account_form
  • woocommerce_before_account_payment_methods
  • woocommerce_after_account_payment_methods
  • woocommerce_before_checkout_shipping_form
  • woocommerce_after_checkout_shipping_form
  • woocommerce_before_checkout_registration_form
  • woocommerce_after_checkout_registration_form
  • woocommerce_checkout_before_terms_and_conditions
  • woocommerce_checkout_after_terms_and_conditions
  • woocommerce_lostpassword_form
  • woocommerce_order_details_after_customer_details
  • woocommerce_pay_order_before_submit
  • woocommerce_pay_order_after_submit
  • woocommerce_product_thumbnails
  • woocommerce_resetpassword_form
  • woocommerce_shop_loop_subcategory_title
  • woocommerce_before_subcategory
  • woocommerce_after_subcategory
  • woocommerce_before_subcategory_title
  • woocommerce_after_subcategory_title
  • woocommerce_view_order

    3 Examples of WooCommerce hooks

    Add a description to the shop page

Add description to shop page

In fact, WooCommerce doesn’t possess the built-in feature to display the description on the shop page. However, by WooCommerce hooks, developers can add it to their shop page. To do that, copy and paste this code to the functions.php file of your store child theme:


function quadlayers_shop_description() {
$description = '<p>Welcome to my shop, please be generous and buy many things, thank you.</p>';
echo $description;
}

add_action('woocommerce_archive_description', 'quadlayers_shop_description');

In this example, the storefront will display the statement “Welcome to my shop, please be generous and buy many things, thank you.” You can change it to the one you like.

Show credit card logos on cart page

show credit card logo on cart page To display credit card logos on the cart page, you can make use of the woocommerce_after_cart_totals hook. By pasting this code to your functions.php file in your child theme, the logo of payment methods supported in your store will be visible in the checkout process:


// Display payment methods on shopping cart page
add_action( 'woocommerce_after_cart_totals', 'available_payment_methods' );
function available_payment_methods() {
echo '<div class="payment-methods-cart-page">
<img scr="..."></img>
</div>
<div class="payment-methods-message">We accept the following payment methods</div>';
}

Note: replace the ... symbol with the link of logos you want to display.

Change WooCommerce breadcrumbs text

Change breadcrumb text

Another example of using WooCommerce hook is to change the breadcrumbs text. For instance, you can change the text in your store pagination from “Home” to “All Products”” easily:


/**
* Change "home" to "all products" in Woo breadcrumbs
*/
add_filter( 'woocommerce_breadcrumb_defaults', 'wcc_change_breadcrumb_home_text' );
function wcc_change_breadcrumb_home_text( $defaults ) {
// Change the breadcrumb home text from 'Home' to 'All Products'
$defaults['home'] = 'All Products';
return $defaults;
}

If you don’t like “All Products”, you can replace it with any words you want.

Final thoughts

The above are three common examples of applying hooks in WooCommerce stores. There are many other hooks available for you, so you can also use them to change other things in your WooCommerce store, stand out your store’s style, and provide customers with a better shopping experience.

Recommend for you
Image Description
SMS, Email Marketing Automation

Top rated Marketing automation for Shopify stores

Learn more
Image Description
SEO Suite

Auto-optimize website elements and structure in one-click.

Learn more
proofo
Boost Sales [Free]

Boost sales: Sales Pop, Trust badges, Countdown timer, more

Learn more
Image Description
Photo Reviews [Free]

Use photo reviews to boost sales

Learn more

Subscribe

Stay in the know

Get special offers on the latest news from AVADA.

40k subscribers has been joined!

Earn $10 in reward now!

comment
iphone
go up