WordPress action hook

woocommerce_before_quantity_input_field

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

“Hook to output something before the quantity input field.”

How to use woocommerce_before_quantity_input_field

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

18 plugins that fire woocommerce_before_quantity_input_field

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_quantity_input_field' ) templates/global/quantity-input.php:34
  2. Quantity Plus Minus Button for WooCommerce icon Quantity Plus Minus Button for WooCommerce10,000+ installs do_action( 'woocommerce_before_quantity_input_field' ) template/global/quantity-input.php:95
  3. CartSuite icon CartSuite5,000+ installs do_action( 'woocommerce_before_quantity_input_field' ) includes/frontend/frontend.php:227
  4. Min Max Step Quantity Limits Manager for WooCommerce icon Min Max Step Quantity Limits Manager for WooCommerce3,000+ installs do_action( 'woocommerce_before_quantity_input_field' ) includes/templates/global/quantity-html5-input.php:30
  5. WPC Product Quantity for WooCommerce icon WPC Product Quantity for WooCommerce2,000+ installs do_action( 'woocommerce_before_quantity_input_field' ) templates/quantity-input.php:84
  6. Direct Checkout icon Direct Checkout1,000+ installs do_action( 'woocommerce_before_quantity_input_field' ) templates/global/default-quantity-input.php:31
  7. Better Usability for WooCommerce icon Better Usability for WooCommerce700+ installs do_action( 'woocommerce_before_quantity_input_field' ) templates/qty-select-cart.php:9
  8. ShopPress icon ShopPress600+ installs do_action( 'woocommerce_before_quantity_input_field' ) public/templates/global/quantity-input-modern.php:19
  9. StoreBuild icon StoreBuild400+ installs do_action( 'woocommerce_before_quantity_input_field' ) public/woocommerce/global/quantity-input.php:36
  10. Visual Builder icon Visual Builder200+ installs do_action( 'woocommerce_before_quantity_input_field' ) inc/woocommerce/single-product/add-to-cart/preview-add-to-cart.php:14
  11. ShopMaker icon ShopMaker90+ installs do_action( 'woocommerce_before_quantity_input_field' ) templates/global/quantity-input.php:31
  12. BlindMatrix e-Commerce icon BlindMatrix e-Commerce10+ installs do_action( 'woocommerce_before_quantity_input_field' ) templates/bm-quantity-input.php:34
  13. Templates Add-on for Woo OnePage icon Templates Add-on for Woo OnePage10+ installs do_action( 'woocommerce_before_quantity_input_field' ) includes/variation-swatch/templates/quantity-input.php:26
  14. Storzen icon StorzenFewer than 10 installs do_action( 'woocommerce_before_quantity_input_field' ) woocommerce/global/quantity-input.php:32
  15. Total Cost Input for WooCommerce icon Total Cost Input for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_quantity_input_field' ) templates/global/quantity-input.php:208
  16. Arshida Toolkit for WooCommerce icon Arshida Toolkit for WooCommerceFewer than 10 installs do_action( 'woocommerce_before_quantity_input_field' ) src/Templates/woocommerce/global/quantity-input.php:25
  17. Min Max Quantity Controls for WooCommerce with Step Control icon Min Max Quantity Controls for WooCommerce with Step ControlFewer than 10 installs do_action( 'woocommerce_before_quantity_input_field' ) includes/templates/global/quantity-input.php:111
  18. Ajax mini cart for Woocommerce icon Ajax mini cart for WoocommerceFewer than 10 installs do_action( 'woocommerce_before_quantity_input_field' ) src/zt-front-end.php:436

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.