WooCommerce is extremely friendly for developers because it has a ton of actions and filters - called hooks. We use them often when we develop WooCommerce plugins and tweak our cart page, here at WP Desk. No matter if you are a beginner or advanced WooCommerce developer, we created this visual guide to help you find just the WooCommerce cart page hooks you're looking for. Let's begin!
Table of contents
- WooCommerce Cart Hooks
- Empty Cart Hook
- The List of Cart Hooks
- Remove the default actions on the cart page
- Add custom sections to the cart page
- Customize the WooCommerce checkout form with a FREE plugin ⭐
- Summary
WooCommerce Cart Hooks
👀 Let's see all hooks available for the WooCommerce cart page. This guide is based on the official WooCommerce theme Storefront.
WooCommerce Empty Cart Hook
There is also 1 hook on the empty cart page:
You can use this hook, for example, to let your customers go to some specific categories, products, or homepage.
WooCommerce Cart Page Hooks 🪝- The Complete List
woocommerce_before_cart
woocommerce_before_cart_table
woocommerce_before_cart_contents
woocommerce_cart_contents
woocommerce_cart_coupon
woocommerce_cart_actions
woocommerce_after_cart_contents
woocommerce_after_cart_table
woocommerce_cart_collaterals
woocommerce_before_cart_totals
woocommerce_cart_totals_before_shipping
woocommerce_after_shipping_rate
woocommerce_before_shipping_calculator
woocommerce_after_shipping_calculator
woocommerce_cart_totals_after_shipping
woocommerce_cart_totals_before_order_total
woocommerce_cart_totals_after_order_total
woocommerce_proceed_to_checkout
woocommerce_after_cart_totals
woocommerce_after_cart
woocommerce_cart_is_empty
Cart filters for products (only for classic cart)
There are also additional filters for WooCommerce classic cart to customize the product listing.
- woocommerce_cart_item_name
- woocommerce_cart_item_price
- woocommerce_cart_item_quantity
- woocommerce_cart_item_subtotal
WooCommerce cart page hooks - how to use them?
- Prepare custom code (or a plugin)
- Use a staging/ testing site before using the code live
- Add the custom code can be added to the theme's functions.php file
- Refresh the cart page (with products)
- Test and optimize the code
Remove the default actions on the cart page
By default only some of the hooks are used by WooCommerce to add:
- cross-sells next to cart totals (
woocommerce_cross_sell_display
) - cart totals next to cross-sells (
woocommerce_cart_totals
) - proceed to checkout button under cart totals (
woocommerce_button_proceed_to_checkout
)
You can easily remove these functions by pasting the following code to the functions.php file in your theme or preferably child theme.
Add custom sections to the cart page
The following easy example shows how to add "free shipping" text above the cart table like this:
WooCommerce Checkout Editor FREE Plugin to customize the checkout form
We have developed a plugin that will help you in editing the WooCommerce checkout form.
Flexible Checkout Fields WooCommerce
Edit, add new or hide unnecessary fields from the WooCommerce checkout form. Add pricing to fields and use conditional logic. It's all about conversions and better user experience. NEW: now you can set multiple conditions (OR) under one or more condition groups (AND).
💾 Active Installations: 90,000+ | WordPress Rating:
Summary
Today, I've shown you the list of WooCommerce cart hooks and how to use them to customize the cart page. Enhancing the WooCommerce cart page with actions and filters may improve appearance (CSS styling, new labels), or add new functionalities.
If you have any questions, let me know in the comment section below!