Disable Tooltip on WooCommerce Quantity Input

If a customer tries to add more of a product than the current WooCommerce stock level, they will see a “tooltip” letting them know they need to use a smaller quantity. This message is generated by the browser and typically isn’t very attractive. Here’s what it looks like in Chrome.

This is generated by the HTML that makes up the quantity input. It’s a “number” input and the specifications allow us to assign minimum and maximum values to the field. We can see that WooCommerce uses the stock levels to add these to the HTML.

There is a way to disable this with a filter. Add this snippet to your theme’s functions.php file or with a plugin like Code Snippets and that should turn this off for you.

add_filter( 'woocommerce_quantity_input_max', '__return_false' );

In case you were wondering, doing this doesn’t remove all validation from the quantity. If a customer tries to add more of the product than we have in stock, they’ll still see an error message.

So if you don’t find this message particularly helpful, you can use that filter to remove it from your store. If you have any questions, post them in the comments below.

One response to “Disable Tooltip on WooCommerce Quantity Input”

  1. Bill Robbins Avatar
    Bill Robbins

    If you also need to hide the stock level, you can do that by adding this CSS. It can be included in the theme’s styles or added to the Additional CSS section of the Customizer.

    p.stock.in-stock {
        display: none;

Leave a Reply

%d bloggers like this: