I need to display my cart when the cart button is clicked, allowing the user to update the quantity of the items in his cart using a dropdown list. I can get the amount of items he chose to add to his cart using the {item_qty} tag, but how do I display this in a dropdownlist (with the maximum number as the total in stock)?

i.e. if the re are 4 items in stock, the dropdownlist should display options 1 - 4.

My code so far:

<select name="items[{key}][item_qty]">
    <option value="{item_qty}">{item_qty}</option>

This displays a dropdownlist with one value (1), but need to display the total in stock.

1 Answer 1


I think it's going to be a bit trickier than that because when you move to the checkout you use the Checkout tags instead of the Product tag. The difference is that in the Product tag item_qty represents the number of items the user wants to buy. In the Checkout tag item_qty represents how many items the user has in their cart. There's not really a ready-made way to do that so you'd need to run a separate query on the product inventory and then use that to populate the drop-down list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.