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:
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.
-
WooCommerce7+ million installs
apply_filters( 'woocommerce_quantity_input_pattern', wc_is_stock_amount_integer() ? '[0-9]*' : '' )includes/wc-template-functions.php:4899 -
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 -
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 -
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 -
CartSuite5,000+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )includes/frontend/frontend.php:414 -
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 -
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 -
Food Menu2,000+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )app/Controllers/MiniCart/MiniCartHooks.php:205 -
Direct Checkout1,000+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )includes/AddToCart.php:434 -
PVT1,000+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )inc/table-parts/content-tbody.php:130 -
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 -
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 -
JustTables500+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )includes/Frontend/views/elements/quantity.php:10 -
StoreBuild400+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' )functions.php:1550 -
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 -
Salevo Boost Sales for WooCommerce200+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )includes/functions.php:318 -
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 -
Shopready100+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' )src/extension/elewidgets/helper/general.php:178 -
Pizza builder for WooCommerce30+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter( 'woocommerce_stock_amount', 'intval' ) ? '[0-9]*' : '' )includes/pizza-functions.php:19 -
TABLEiT20+ installs
apply_filters( 'woocommerce_quantity_input_pattern', has_filter('woocommerce_stock_amount', 'intval') ? '[0-9]*' : '' )templates/quantity.php:22 -
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 -
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.