WordPress action hook

woocommerce_before_cart_totals

Defined by WooCommerce and fired by 12 plugins in total, running on 8M+ sites between them.

How to use woocommerce_before_cart_totals

It's an action: your callback runs at that point. Nothing needs to be returned. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_action( 'woocommerce_before_cart_totals', function() {
	// Your code runs here.
}, 10, 1 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

12 plugins that fire woocommerce_before_cart_totals

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs do_action( 'woocommerce_before_cart_totals' ) templates/cart/cart-totals.php:23
  2. Essential Addons for Elementor icon Essential Addons for Elementor1+ million installs do_action( 'woocommerce_before_cart_totals' ) includes/Template/Woocommerce/Cart/Woo_Cart_Helper.php:268
  3. CoDesigner icon CoDesigner4,000+ installs do_action( 'woocommerce_before_cart_totals' ) widgets/cart-overview/assets/templates/cart-totals.php:76
  4. WowStore icon WowStore4,000+ installs do_action( 'woocommerce_before_cart_totals' ) blocks/woo/cart_total/Template.php:18
  5. WC Booster icon WC Booster700+ installs do_action( 'woocommerce_before_cart_totals' ) woocommerce/cart/cart-totals.php:23
  6. ShopPress icon ShopPress600+ installs do_action( 'woocommerce_before_cart_totals' ) public/templates/cart/cart-totals.php:14
  7. KiriminAja Official icon KiriminAja Official200+ installs do_action( 'woocommerce_before_cart_totals' ) templates/woocommerce/cart/cart-totals.php:29
  8. Shopready icon Shopready100+ installs do_action( 'woocommerce_before_cart_totals' ) src/extension/templates/tpl/cart/cart-totals.php:16
  9. WebSync Checkout for Elementor icon WebSync Checkout for Elementor50+ installs do_action( 'woocommerce_before_cart_totals' ) templates/cart/custom-cart-totals.php:27
  10. Global Seller Services for WooCommerce icon Global Seller Services for WooCommerce10+ installs do_action( 'woocommerce_before_cart_totals' ) templates/TaxCalculation/cart-totals.php:71
  11. Max Elements for Elementor icon Max Elements for Elementor10+ installs do_action( 'woocommerce_before_cart_totals' ) elementor/helpers/woo_cart.php:232
  12. Cresta Checkout for WooCommerce icon Cresta Checkout for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_cart_totals' ) inc/blocks/blocks-cart.php:266

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.