Created
November 29, 2015 15:39
-
-
Save vistajess/62686efe6cccacd5ed5e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment