In testing my bundles app, I discovered a quirk/bug, which I wanted to run by the community in case I was missing something.
When increasing the quantity of a bundle product in the cart and/or drawer, after a certain quantity, I get an error stating only x quantity can be added to the cart. which is less than the available inventory?!?!
Specifically, my 2-item custom bundle product has an inventory of 12, with three components (A, B, C) having inventory of 8, 8, and 9 respectively. When building my bundle, I have two selections, and set each selection to component A. In the cart drawer, I then test by increasing the line item quantity pressing the +
button, which correctly increments to quantity 4 (component A inventory 8 / 2 selections = 4).
If I then attempt to increment the line item quantity again to 5, I get an error message that I can only add quantity 3 to the cart?!?!? Where did 3 come from?
I checked my cart transform function and there are no errors. I checked the cart JSON via the Cart API, no errors there either. I believe the sections within the cart drawer are rendered by the Section Rendering “API”, so where is it getting a maximum quantity of 3 from?
I am testing with the Dawn theme, so I reviewed the liquid code for the cart drawer, and found the following lines relating to the quantity input:
<input
...
{% if item.variant.quantity_rule.max != null %}
max="{{ item.variant.quantity_rule.max }}"
{% endif %}
...
</input>
I can confirm I do not have any quantity rules configured, so the input
element will not have a max
attribute set. I’m puzzled as to where the maximum quantity 3 is coming from?
Any input/feedback/guidance would be greatly appreciated.