WooCommerce Hooks in Brief: Add and Remove a Checkout Action

Quick Summary

  • Hook a callback to woocommerce_checkout_before_order_review with add_action() to print notices, trust badges or other HTML above the checkout order summary.
  • remove_action() needs the same hook, function name and priority, and must run after the callback is added, for example on init or wp.
  • The checkout action hooks only run on the classic [woocommerce_checkout] shortcode checkout, not the block-based Checkout.

WooCommerce fires action hooks throughout the checkout page, so you can add content without editing template files. woocommerce_checkout_before_order_review runs just before the order review section, which holds the order summary table and the payment options. Use it to print a notice, trust badges or any other HTML above the order summary.

These hooks belong to the classic checkout (the [woocommerce_checkout] shortcode); the block-based Checkout doesn’t run them. Add the code to your child theme’s functions.php or a plugin.

Add a callback

Replace the comment inside the function with your own output, for example an echo with your HTML.

PHP
// define the woocommerce_checkout_before_order_review callback 
function action_woocommerce_checkout_before_order_review(  ) { 
    // make action magic happen here... 
}; 
         
// add the action 
add_action( 'woocommerce_checkout_before_order_review', 'action_woocommerce_checkout_before_order_review', 10, 0 );
  • 10 is the priority; when several functions use the same hook, lower numbers run first.
  • 0 is the number of arguments passed to your function. This hook doesn’t pass any.
  • Give the function a unique name with your own prefix to avoid conflicts.

Remove a callback

To unhook a function, call remove_action() with the same hook name, function name and priority you used to add it.

PHP
// remove the action 
remove_action( 'woocommerce_checkout_before_order_review', 'action_woocommerce_checkout_before_order_review', 10, 0 );
  • The priority must match, or nothing happens. remove_action() doesn’t take an argument count, so the final 0 is ignored.
  • remove_action() only works once the matching add_action() has run. If a plugin or parent theme adds it, run your removal on a hook that fires after that, such as init or wp.

Hooks like these are how I customize a store without editing WooCommerce’s own files; see my WooCommerce development services.

Share on X (opens in a new tab) Share on LinkedIn (opens in a new tab) Share on Facebook (opens in a new tab)

ChatGPT (opens in a new tab) Claude (opens in a new tab) Gemini (opens in a new tab) Perplexity (opens in a new tab) Grok (opens in a new tab)

More Insights

See More