Skip to content

Instantly share code, notes, and snippets.

@jobthomas
Forked from mikejolley/functions.php
Last active July 31, 2017 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jobthomas/c8bc262b815e5e0d05b29133ba79b2e3 to your computer and use it in GitHub Desktop.
Save jobthomas/c8bc262b815e5e0d05b29133ba79b2e3 to your computer and use it in GitHub Desktop.
WooCommerce - Adjust the default quantity
// Simple products
add_filter( 'woocommerce_quantity_input_args', 'jk_woocommerce_quantity_input_args', 10, 2 );
function jk_woocommerce_quantity_input_args( $args, $product ) {
if ( is_singular( 'product' ) ) {
$args['input_value'] = 2; // Starting value (we only want to affect product pages, not cart)
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment