/* * Changing the maximum quantity to 1 for all the WooCommerce products */ function woocommerce_quantity_input_max_callback( $max, $product ) { $max = 1; return $max; } add_filter( 'woocommerce_quantity_input_max', 'woocommerce_quantity_input_max_callback', 10, 2 ); ?>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter