Skip to content

Instantly share code, notes, and snippets.

@goranefbl
Created October 7, 2015 13:18
Show Gist options
  • Save goranefbl/c042fa44edd9e88434f0 to your computer and use it in GitHub Desktop.
Save goranefbl/c042fa44edd9e88434f0 to your computer and use it in GitHub Desktop.
Add quantity to the archive page
add_action( 'woocommerce_after_shop_loop_item', 'my_custom_quantity_field', 9 );
function my_custom_quantity_field() {
global $product;
if ( ! $product->is_sold_individually() )
woocommerce_quantity_input( array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', 1, $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->backorders_allowed() ? '' : $product->get_stock_quantity(), $product )
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment