Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. handleLimit(elem) {
  2. const { product } = this.props;
  3. const qtyOrdered = cartItem ? cartItem.qty_ordered : 0;
  4. // Checks the difference of the Inventory and Quantity Ordered
  5. const inventoryOrderDifference = product.quantity - qtyOrdered;
  6. const max_chars = inventoryOrderDifference.toString().length;
  7.  
  8. if(this.state.qty.toString().length > max_chars) {
  9. elem = elem.value.substr(0, max_chars);
  10. }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement