/** * Add quantity selector to the category page */ add_filter('woocommerce_loop_add_to_cart_link', 'cc_add_quantity_inputs_on_category_page', 10, 2); function cc_add_quantity_inputs_on_category_page( $html, $product ) { if ($product && $product->is_type('simple') && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually()) { $html = '
'; } return $html; }