One of my customer ask me how to add a quantity label before add to cart button in single product page. So here i discuss how to Add “Quantity” Label in front of Add to Cart Button WooCommerce.
So let’s do it. Add this following line of code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file.
Refresh your single product page, You can see that “Quantity” label set in front of “Add to Cart” Button.
add_action( 'woocommerce_before_add_to_cart_quantity', 'wp_echo_qty_front_add_cart' ); function wp_echo_qty_front_add_cart() { echo 'Quantity:'; }
Also Add Couple of CSS in your theme’s style.css file of your active child theme (or theme) and Save the file.
div.qty { float: left; padding: 10px; }
1 Comment. Leave new
Hi,
Thanks for your post, great help! How would you do it for specific product categories and display on every product page?
Thank you!