• Resolved asw

    (@astreetweb)


    I want to edit this woocommerce edit stock quantity error message. When I put more items in cart than I have in stock, I get message “please select a value that is no more than N” where N equals the number of that item I have in stock. I would like to change the text of this message but I cannot find where it is coming from. I have search all woocommerce files but cannot find the string. Does anyone know where to find it?

    https://www.ads-software.com/plugins/woocommerce/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    I think you’re referring to the html5 validation on number inputs. This is controlled by your browser so you cannot translate this wording.

    https://www.wufoo.com/html5/attributes/04-minmaxstep.html

    Thread Starter asw

    (@astreetweb)

    Well that sucks. The message seems like it would be confusing to most people. Is there a way to disable it, then?

    I see that class-wc-cart.php (line 484) has error message “Sorry, we do not have enough “%s” in stock to fulfill your order (%s in stock)” which does clearly inform customer of error but it looks like it can not be invoked because he can never enter too many.

    Thanks for replying, Mike. Not being able to find it was making me crazy.

    I second this. Need a way to either remove that pop-up tool tip or better yet – change the language. There are tons of instances where a shop would never want to disclose to a customer how many items they have left in stock – such as ticketing for an event.
    A message saying ‘not enough stock available’ would be sufficient.

    Any heroes out there who can help?

    It should be possible to alter the browser’s default messages if you can write some javascript. This post explains the method:
    https://www.sagarganatra.com/2011/07/custom-validation-messages-for-html5.html

    Next you will also need to load your javascript into the page with something like:

    <?php
    add_action( 'wp_enqueue_scripts', 'add_my_script' );
    function add_my_script() {
      wp_enqueue_script( 'my-js', '/wp-content/uploads/my_script.js', array(), "1", true);
    }

    Another approach to try would be to copy
    wp-content/plugins/woocommerce/templates/global/quantity-input.php
    to
    wp-content/themes/your-theme/woocommerce/global/quantity-input.php
    and in the copy, change the input type from number to text. There may be consequences which will need to be debugged. PHP skills would be required.

    @mikejolly I am getting this error on my Chrome Console:

    An invalid form control with name=’_download_limit’ is not focusable.
    post.php?post=51761&action=edit:1 An invalid form control with name=’_download_expiry’ is not focusable.

    My product is not even a download.

    • This reply was modified 7 years, 7 months ago by m_donglyph.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘please select a value that is no more than’ is closed to new replies.