I have searched the simpleCart documentation, found here, the github page, and here extensively, to find an answer to what should be a simple issue to solve:
I need to get the quantity of a single item in the cart, so I can check it against a custom attribute containing a maximum quantity, along with the quantity being sent to the cart when an item is added.
simpleCart.quantity(); gives me the total for ALL the items in the cart, same with simpleCart.item.quantity();. Meanwhile, item.get('quantity') gives me the amount I am sending to the cart, which I need but isnt the value I am looking for.
Here is the relevant code for context
if (simpleCart.has(item)) {
var mA = item.get( 'maxamount' );
var linkQty = item.get('quantity');
totalquant = (item.quantity() + linkQty);
alert('Max amount: '+mA+'\nQty sent to cart: '+linkQty+'\nQty in cart plus qty sent to cart: '+totalquant);
if(totalquant > mA){
alert("You can not select more than "+mA+" items of this size!");
return false;
}
}
I am aware this exact question exists on this site, but it recieved no response. Please can someone help me?