WordPress filter hook

woocommerce_quantity_input_pattern

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

How to use woocommerce_quantity_input_pattern

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_quantity_input_pattern', function( $is_stock_amount_integer ) {
	// Change $is_stock_amount_integer here.
	return $is_stock_amount_integer;
}, 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.

22 plugins that fire woocommerce_quantity_input_pattern

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

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_quantity_input_pattern', wc_is_stock_amount_integer() ? '[0-9]*' : '' ) includes/wc-template-functions.php:4899
  2. Side Cart Woocommerce icon Side Cart Woocommerce70,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/xoo-wsc-functions.php:149
  3. Product Table & List Builder for WooCommerce icon Product Table & List Builder for WooCommerce10,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' ) templates/quantity.php:23
  4. Cart Popup for WooCommerce icon Cart Popup for WooCommerce9,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) templates/xoo-cp-content.php:45
  5. CartSuite icon CartSuite5,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/frontend/frontend.php:414
  6. XT Floating Cart for WooCommerce icon XT Floating Cart for WooCommerce4,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', ( has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) ) public/functions-global.php:486
  7. Art WooCommerce Order One Click icon Art WooCommerce Order One Click4,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) classes/Prepare/Popup.php:215
  8. Food Menu icon Food Menu2,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) app/Controllers/MiniCart/MiniCartHooks.php:205
  9. Direct Checkout icon Direct Checkout1,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/AddToCart.php:434
  10. PVT icon PVT1,000+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) inc/table-parts/content-tbody.php:130
  11. Bulk Order Form for WooCommerce icon Bulk Order Form for WooCommerce800+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) form_templates/class-standard-product-search.php:276
  12. Enhanced AJAX Add to Cart for WooCommerce icon Enhanced AJAX Add to Cart for WooCommerce600+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/abstract-eaa2c-button.php:240
  13. JustTables icon JustTables500+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/Frontend/views/elements/quantity.php:10
  14. StoreBuild icon StoreBuild400+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' ) functions.php:1550
  15. Product Quantity Dropdown For Woocommerce icon Product Quantity Dropdown For Woocommerce200+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) main/frontend/pqdfw-frontend.php:23
  16. Salevo Boost Sales for WooCommerce icon Salevo Boost Sales for WooCommerce200+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/functions.php:318
  17. Autoship Cloud for WooCommerce Subscription Products icon Autoship Cloud for WooCommerce Subscription Products100+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) src/scheduled-orders.php:1117
  18. Shopready icon Shopready100+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' ) src/extension/elewidgets/helper/general.php:178
  19. Pizza builder for WooCommerce icon Pizza builder for WooCommerce30+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) includes/pizza-functions.php:19
  20. TABLEiT icon TABLEiT20+ installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' ) templates/quantity.php:22
  21. Ajax mini cart for Woocommerce icon Ajax mini cart for WoocommerceFewer than 10 installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) src/zt-front-end.php:407
  22. WT Quick Reorder icon WT Quick ReorderFewer than 10 installs apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' ) public/includes/wt-table-column-functions.php:159

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.