Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- handleLimit(elem) {
- const { product } = this.props;
- const qtyOrdered = cartItem ? cartItem.qty_ordered : 0;
- // Checks the difference of the Inventory and Quantity Ordered
- const inventoryOrderDifference = product.quantity - qtyOrdered;
- const max_chars = inventoryOrderDifference.toString().length;
- if(this.state.qty.toString().length > max_chars) {
- elem = elem.value.substr(0, max_chars);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement