WordPress action hook

woocommerce_before_cart

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

“Hook for print notices. woocommerce_before_single_product hook.”

How to use woocommerce_before_cart

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', 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.

46 plugins that fire woocommerce_before_cart

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' ) templates/cart/cart.php:20
  2. Essential Addons for Elementor icon Essential Addons for Elementor1+ million installs do_action( 'woocommerce_before_cart' ) includes/Template/Woocommerce/Cart/Woo_Cart_Shortcode.php:73
  3. Royal Addons for Elementor icon Royal Addons for Elementor600,000+ installs do_action( 'woocommerce_before_cart' ) includes/woocommerce/templates/cart/cart.php:20
  4. ShopEngine icon ShopEngine90,000+ installs do_action( 'woocommerce_before_cart' ) widgets/cart-table/screens/cart.php:6
  5. Sliding Cart for WooCommerce by FunnelKit icon Sliding Cart for WooCommerce by FunnelKit30,000+ installs do_action( 'woocommerce_before_cart' ) compatibilities/wpfactoryminmaxamount.php:25
  6. Solace Extra icon Solace Extra10,000+ installs do_action( 'woocommerce_before_cart' ) elementor/widgets/widget/shop/cart.php:2584
  7. CoDesigner icon CoDesigner4,000+ installs do_action( 'woocommerce_before_cart' ) widgets/cart-items/cart-items.php:1886
  8. WowStore icon WowStore4,000+ installs do_action( 'woocommerce_before_cart' ) blocks/woo/cart_table/Template.php:7
  9. Ultimate Store Kit icon Ultimate Store Kit3,000+ installs do_action( 'woocommerce_before_cart' ) includes/builder/templates/woocommerce/cart.php:20
  10. ShopEngine Gutenberg WooCommerce Builder Blocks Addon icon ShopEngine Gutenberg WooCommerce Builder Blocks Addon3,000+ installs do_action( 'woocommerce_before_cart' ) blocks/cart-table/cart.php:9
  11. WP Hotel Booking WooCommerce icon WP Hotel Booking WooCommerce1,000+ installs do_action( 'woocommerce_before_cart' ) templates/woocommerce/cart/cart.php:25
  12. Instantio icon Instantio700+ installs do_action( 'woocommerce_before_cart' ) includes/templates/cart-modern.php:26
  13. WC Booster icon WC Booster700+ installs do_action( 'woocommerce_before_cart' ) woocommerce/cart/cart.php:20
  14. MarketKing icon MarketKing700+ installs do_action( 'woocommerce_before_cart' ) public/templates/cart.php:16
  15. ShopPress icon ShopPress600+ installs do_action( 'woocommerce_before_cart' ) public/templates/cart/cart.php:12
  16. StoreBuild icon StoreBuild400+ installs do_action( 'woocommerce_before_cart' ) public/templates/cart.php:29
  17. Noah Shop Builder for WooCommerce icon Noah Shop Builder for WooCommerce300+ installs do_action( 'woocommerce_before_cart' ) includes/Templates/Types/Cart.php:109
  18. CRT Addons Builder and Widgets for Elementor icon CRT Addons Builder and Widgets for Elementor300+ installs do_action( 'woocommerce_before_cart' ) includes/customizer/addons/templates/cart/cart.php:20
  19. Free Product Sample for WooCommerce icon Free Product Sample for WooCommerce200+ installs do_action( 'woocommerce_before_cart' ) public/partials/woocommerce/cart/cart.php:20
  20. KiriminAja Official icon KiriminAja Official200+ installs do_action( 'woocommerce_before_cart' ) templates/woocommerce/cart/cart.php:20
  21. Shopready icon Shopready100+ installs do_action( 'woocommerce_before_cart' ) src/extension/templates/presets/cart/cart.php:40
  22. RestroFood Lite icon RestroFood Lite100+ installs do_action( 'woocommerce_before_cart' ) inc/helper-functions.php:1028
  23. ShopMaker icon ShopMaker90+ installs do_action( 'woocommerce_before_cart' ) templates/widgets/sm-parts/cart-table.php:12
  24. AMP WooCommerce icon AMP WooCommerce90+ installs do_action( 'woocommerce_before_cart' ) templates/cart/cart.php:9
  25. Gift Vouchers for WooCommerce icon Gift Vouchers for WooCommerce70+ installs do_action( 'woocommerce_before_cart' ) templates/cart/cart.php:13
  26. WebSync Checkout for Elementor icon WebSync Checkout for Elementor50+ installs do_action( 'woocommerce_before_cart' ) templates/cart/custom-cart.php:21
  27. One Page Checkout for WooCommerce icon One Page Checkout for WooCommerce30+ installs do_action( 'woocommerce_before_cart' ) public/templates/cart/cart.php:22
  28. Restaurant Menu / bulk order plugin for WooCommerce icon Restaurant Menu / bulk order plugin for WooCommerce20+ installs do_action( 'woocommerce_before_cart' ) front/view/woocommerce/cart/cart-empty.php:36
  29. Elite Elementor Addons and Widgets icon Elite Elementor Addons and Widgets20+ installs do_action( 'woocommerce_before_cart' ) includes/woocommerce/templates/cart/cart.php:20
  30. Formdev icon Formdev10+ installs do_action( 'woocommerce_before_cart' ) templates/cart.php:61
  31. wcOne icon wcOne10+ installs do_action( 'woocommerce_before_cart' ) inc/helper-functions.php:874
  32. SBS icon SBS10+ installs do_action( 'woocommerce_before_cart' ) templates/cart/cart.php:14
  33. Max Elements for Elementor icon Max Elements for Elementor10+ installs do_action( 'woocommerce_before_cart' ) elementor/helpers/woo_cart.php:777
  34. Express Shop for WooCommerce Product Table icon Express Shop for WooCommerce Product Table10+ installs do_action( 'woocommerce_before_cart' ) inc/cart/cart.php:20
  35. Categorized Cart Page For Woocommerce icon Categorized Cart Page For Woocommerce10+ installs do_action( 'woocommerce_before_cart' ) templates/cart.php:4
  36. Manual Orders for Woocommerce icon Manual Orders for Woocommerce10+ installs do_action( 'woocommerce_before_cart' ) templates/checkout/cart.php:11
  37. C4D Woo Cart Popup & Slide icon C4D Woo Cart Popup & Slide10+ installs do_action( 'woocommerce_before_cart' ) templates/popup-cart.php:5
  38. MCOD Minimalist Checkout for WooCommerce icon MCOD Minimalist Checkout for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_cart' ) templates/woocommerce/cart/cart-empty.php:37
  39. Bazario icon BazarioFewer than 10 installs do_action( 'woocommerce_before_cart' ) elements/widgets/cart-products/cart.php:10
  40. ShopGlut icon ShopGlutFewer than 10 installs do_action( 'woocommerce_before_cart' ) modules/cart-page/frontend/cart.php:10
  41. Cresta Checkout for WooCommerce icon Cresta Checkout for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_cart' ) templates/wc/cart/cart.php:14
  42. PaymentIQ Checkout icon PaymentIQ CheckoutFewer than 10 installs do_action( 'woocommerce_before_cart' ) templates/paymentiq-cart-page.php:20
  43. Portus Cart Page icon Portus Cart PageFewer than 10 installs do_action( 'woocommerce_before_cart' ) templates/cart.php:5
  44. Aiolos Checkout for WooCommerce icon Aiolos Checkout for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_cart' ) src/Compat/CartHooks.php:136
  45. Samply icon SamplyFewer than 10 installs do_action( 'woocommerce_before_cart' ) includes/Frontend/views/woocommerce/cart/cart.php:20
  46. Points and Rewards with WooCommerce Blocks icon Points and Rewards with WooCommerce BlocksFewer than 10 installs do_action( 'woocommerce_before_cart' ) includes/class-points-and-rewards-with-wcb.php:70

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.