WooCommerce Hooks Guide: Full List and Examples

WooCommerce Hooks are undoubtedly important and placing them correctly help to extend the functionality of a store without making changes to the core code of the store’s theme. This blog post will highlight the full list of WooCommerce hooks, describe the main areas of their use and provide some examples of hook placement.
In the article we’ll give the full list of WooCommerce Hooks and will describe the main areas of their use, we’ll also give examples of areas for Hooks placing so that it’ll be easier to use them in the future.
At first some general facts about WooCommerce Hooks. They are designed like another WordPress Hooks and used for setting markup for all pages resulting in faster use of Actions and Filters on them.
As it was mentioned above hooks enable the creation of independent plugins and extensions and don’t modify the main code of WordPress, WooCommerce and other plugins thus eliminating any negative effects on software stability and updatability.
All in all, WooCommerce is marked by hooks very well and lets to expand store’s opportunities easily. Read on and learn more about the areas currently marked by the hooks.
Also, to expand your WooCommerce store’s opportunities automatically you can use our Premmerce Permalink Manager Plugin that allows you to configure URL generation strategy and Premmerce WooCommerce Product Filter Plugin for managing filters for WooCommerce products.
WooCommerce Global Hooks
We’ve referred three hooks to global and they are displayed on the main pages allowing to make some considerable modifications. Among them:
pre_get_product_search_form
It enables adding some data above the basic search of products.
woocommerce_breadcrumb
It allows to display data above the breadcrumbs URLs.
woocommerce_no_products_found
It allows to display the needed data on the Search page if no products have been found.
WooCommmerce Cart Hooks
In general, the Cart page on WooCommerce is marked very well. We’ve divided all the hooks, that are used on the Cart page, into three groups for convenience.
The hooks that are displayed before the product list in the cart
They are:
- woocommerce_before_cart
- woocommerce_before_cart_table
- woocommerce_before_cart_contents
- woocommerce_cart_contents
- woocommerce_after_cart_contents
The hooks that are displayed after the product list in the cart
They are:
- woocommerce_cart_coupon
- woocommerce_cart_actions
- woocommerce_after_cart_table
- woocommerce_cart_collaterals
- woocommerce_before_cart_totals
The hooks that are displayed at the end of an order
They are:
- woocommerce_cart_totals_before_shipping
- woocommerce_cart_totals_after_shipping
- woocommerce_cart_totals_before_order_total
- woocommerce_cart_totals_after_order_total
- woocommerce_after_shipping_rate
- woocommerce_before_shipping_calculator
- woocommerce_proceed_to_checkout
- woocommerce_after_cart_totals
- woocommerce_after_cart
In case there are no products in the cart
You can use the following hook:
woocommerce_cart_is_empty
WooCommerce Checkout Hooks
As the Checkout page on WooCommerce is very functional, we’ve decided to divide all the hooks, that are used here, into several categories.
The hooks that are used before the form of user contact information
They are:
- woocommerce_before_checkout_form
- woocommerce_checkout_before_customer_details
- woocommerce_checkout_billing
- woocommerce_before_checkout_billing_form
The hooks that are used for setting markup of billing details
They are:
- woocommerce_after_checkout_billing_form
- woocommerce_checkout_shipping
- woocommerce_before_order_notes
- woocommerce_after_order_notes
- woocommerce_checkout_after_order_review
The hooks that are used before the product summary in the order
They are:
- woocommerce_checkout_after_customer_details
- woocommerce_checkout_before_order_review
- woocommerce_review_order_before_cart_contents
- woocommerce_review_order_after_cart_contents
- woocommerce_review_order_before_shipping
- woocommerce_review_order_after_shipping
- woocommerce_review_order_before_order_total
- woocommerce_review_order_after_order_total
The hooks that are displayed below the order form
They are:
- woocommerce_checkout_order_review
- woocommerce_review_order_before_payment
- woocommerce_review_order_before_submit
- woocommerce_review_order_after_submit
- woocommerce_review_order_after_payment
- woocommerce_after_checkout_form
The hooks that are displayed in the product list of an order.
They are:
- woocommerce_order_items_table
- woocommerce_order_item_meta_start
- woocommerce_order_item_meta_end
- woocommerce_order_details_after_order_table
- woocommerce_thankyou
WooCommerce Product Hooks
In this part we’ll review all hooks that are used on the Product page. There is a number possible hooks here and that’s why we’ve divided them into several categories according to their purpose. We use them at our Premmerce WooCommerce Product Filter Plugin for filtering results without reloading the page.
The hooks that are displayed at the top and at the foot of the Product page
They are:
- woocommerce_before_main_content
- woocommerce_after_main_content
The hooks that are displayed above and below a product description
They are:
- woocommerce_before_single_product_summary
- woocommerce_after_single_product_summary
The hooks that are displayed at the top and at the foot of the Product page
They are:
- woocommerce_before_single_product
- woocommerce_after_single_product
The hooks that are displayed in the short product description
They are:
- woocommerce_single_product_summary
- woocommerce_product_meta_start
- woocommerce_product_meta_end
- woocommerce_share
The hooks that are displayed in the comments
They are:
- woocommerce_review_before
- woocommerce_review_before_comment_meta
- woocommerce_review_meta
- woocommerce_review_before_comment_text
- woocommerce_review_comment_text
- woocommerce_review_after_comment_text
WooCommerce Category Hooks
WooCommerce provides some hooks for working with the product categories. Let’s review them with screenshots for better visualization. These ones we use at our Premmerce WooCommerce Variation Swatches Plugin to optimize the WooCommerce based online stores with large databases of products, attributes and variations.
woocommerce_archive_description
It is displayed below the category title
woocommerce_shop_loop
It is displayed before the Product card in the list.
woocommerce_before_shop_loop
It is displayed above the product list in the category.
woocommerce_after_shop_loop
It is displayed below the product list in the category.
woocommerce_after_shop_loop_item
It is displayed at the end of every Product card description.
The hooks that additionally mark the Product card in the list.
They are:
- woocommerce_after_shop_loop_item_title
- woocommerce_shop_loop_item_title
- woocommerce_before_shop_loop_item_title
WooCommerce My Account Hooks
These hooks are for the detailed marking of the My Account page. We’ve also divided them into two categories.
The main hooks for setting markup of the My Account page
They are:
- woocommerce_before_account_navigation
- woocommerce_after_account_navigation
- woocommerce_account_navigation
- woocommerce_before_edit_account_address_form
- woocommerce_after_edit_account_address_form
- woocommerce_account_content
The additional hooks for setting markup of the My Account page
They are:
- woocommerce_account_dashboard
- woocommerce_before_my_account
- woocommerce_after_my_account
WooCommerce Mini Cart Hooks
These hooks serve to set markup the mini cart that is displayed in the sidebar if you use advanced WooCommerce display settings.
They are:
- woocommerce_before_mini_cart
- woocommerce_before_mini_cart_contents
- woocommerce_mini_cart_contents
- woocommerce_widget_shopping_cart_before_buttons
- woocommerce_widget_shopping_cart_buttons
- woocommerce_after_mini_cart
WooCommerce Email Hooks
They are used for setting email markup. The emails that are sent to the customers after the purchase are marked up and they usually contain a product list.
They are:
- woocommerce_email_after_order_table
- woocommerce_email_before_order_table
- woocommerce_email_customer_details
- woocommerce_email_footer
- woocommerce_email_header
- woocommerce_email_order_details
- woocommerce_email_order_meta
Other Hooks
We’ve described the main hooks that are usually used for setting markup and extension of the basic WooCommerce functionality.
There are also some Hooks that are not so often used. Here is the whole list of them:
- woocommerce_after_account_downloads
- woocommerce_after_account_orders
- woocommerce_after_account_payment_methods
- woocommerce_before_account_download
- woocommerce_before_account_order
- woocommerce_before_account_orders_paginatio
- woocommerce_before_account_payment_method
- woocommerce_edit_account_for
- woocommerce_edit_account_form_en
- woocommerce_edit_account_form_star
- woocommerce_resetpassword_for
- woocommerce_after_available_downloads
- woocommerce_after_checkout_registration_form
- woocommerce_after_checkout_shipping_form
- woocommerce_after_edit_account_form
- woocommerce_after_subcategor
- woocommerce_after_subcategory_titl
- woocommerce_auth_page_foote
- woocommerce_auth_page_heade
- woocommerce_available_download_en
- woocommerce_available_download_star
- woocommerce_before_available_download
- woocommerce_before_checkout_registration_for
- woocommerce_before_checkout_shipping_for
- woocommerce_before_edit_account_for
- woocommerce_before_subcategor
- woocommerce_before_subcategory_titl
- woocommerce_cart_has_error
- woocommerce_checkout_after_terms_and_condition
- woocommerce_checkout_before_terms_and_condition
- woocommerce_lostpassword_for
- woocommerce_order_details_after_customer_detail
- woocommerce_pay_order_after_submi
- woocommerce_pay_order_before_submi
- woocommerce_product_thumbnail
- woocommerce_shop_loop_subcategory_titl
- woocommerce_view_order
In case you need some additional explanations on any hook usage you’re welcome to leave your comments and we’ll give more information on the topic you’re interested in promptly, or you see see how we use hooks in our products at Premmerce WooCommerce Plugins list.
- Previous « Premmerce WooCommerce Brands Free Plugin
- Next Premmerce WooCommerce Product Search »
Hello,
Great source of information but only appears to include the hooks that affect the visual aspects of WooCommerce. Do you have a resource for the non-visual hooks? I am currently specifically looking for ‘woocommerce_after_checkout_validation’ and what is actually in the ‘data’ array.
Nicely done! So well laid out. Long!!!!! I was looking to add a checkbox/radio button somewhere on the cart page that says “Custom Message” and that message basically creates a second note and gets applied to the admin email notification and inside WC as well. I didn’t see anything that closely resembled adding a message to the admin email notice. Is that something you’ve ever seen around?
Thanks in advance.
Hi.
In short, you must first display this field, make it hide if the checkbox is not checked, and then save this data when ordering.
Hi, from Ecuador. I think you have a very important information here. But, mi question is, if I want some kind of calculation to be made, for example, if I want some discount to users who are registered and active. Which hook should I use, to achieve that. I want one that calculate, for instance 20% of discount. And shows in a new line. Obviously, made the calculation in the checkout to receive payments.
I don’t know if I explained well, but if you throw me some light I’ll really thank you for that.
Gerardo
Thank you! Very helpful. I’m looking for the hook after thumbnail gallery product in single product page. Can you help me? Thanks in advance.
Hi the a very very nice blog and thanks
so what are the hooks for the product images and image gallery. and how to use them?
Great images of all the woocommerce hooks and exactly where they occur in the layout, been looking for something like this, thanks!
hi, some one have idea how to share whole cart to others users e.i ( there are 3 departments like IT ,Admin & Accounts ,so let’s suppose if IT department orders the items form site ,and don’t want to pay from their account at the other hand share it to admin for whole cart which they ordered ,and Admin have received IT order cart and pay their own account , some one please assist me , how can i create that custom module in WordPress woocommerce site .thanks!