When user is adding/increasing quantity than how to we can restrict him ? He can't add/increase quantity more than available saleable quantity.
How to we can apply validation for display error message available quantity is not more than this ?
First find phtml
file that's used for quantity input and then fetch saleable quantity for product using product object or as per you get.
Once you successfully got product saleable quantity then add that value on quantity input attribute "maxlength"
like maxlength="product saleable quantity value"
after that user don't able to increase quantity more than available saleable quantity.
I hope this is useful for you.
You should use in text form field like :
... class="required-entry validate-digits-range digits-range-1-20"...
This will validate the value to be between 1 and 20.