WooCommerce Hooks Guide: Full List and Examples

Jul 3, 2020

WooCommerce Hooks are a powerful tool for extending the functionality of an online store without modifying the core code of the theme. In this blog post, we will provide a comprehensive list of WooCommerce Hooks, explain their main uses, and give examples of where they can be placed.

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.

WooCommerce Hooks are similar to WordPress Hooks and are used to set the markup for all pages, making it easier to implement Actions and Filters.

By using WooCommece Hooks, it’s possible to create independent plugins and extensions without altering the core code of WordPress, WooCommerce, or other plugins. This approach ensures the stability and updatability of the software.

WooCommerce Hooks are a well-documented and straightforward way to expand the capabilities of an online store. By the end of this post, you’ll have a solid understanding of how to use them effectively.

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

Hooks displayed after the product list in the cart

The hooks displayed after the product list in the cart 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

The hooks that are displayed at the end of an order 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

If there are no products in the cart we see:

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.

Hooks used before the user contact information form

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 order’s product summary

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 with our 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 with 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 our WooCommerce Plugins list.

Comments

Avatar
Author
Ivan Pylypchuk
4 min read
Share this post:

Ready to Get Started?

Join over 100,000 smart shop owners who use Premmerce plugins to power their WooCommerce stores.

Get started