Quantity limiter for downloadable products is broken 2.0.14

I just created this bug - hope to hear an answer for it soon:

When trying to add a Electronic Goods product to the cart, a variety of symptoms occur:

  1. The product can be added once and subsequent attempts to add it again will result in the message “The product has already been added to the cart.”

  2. The product can be added multiple times and checkout can occur. However, returning to the shopping screens and attempting to add it again results in a message stating that a negative number of the product has been added to the cart to bring it back to quantity 1.

  3. The product is added once, but when checking out immediately, the product disappears from the cart completely.

    Scenario 1 is ok. Scenario 2 is moderately confusing, but ok. Scenario 3 is unacceptable. Customers call in frustration, asking why they can’t add products to the cart.

    This should be handled through disabling the ‘Add to Cart’ button once it has been clicked for products where only one can be ordered, and/or changing it’s message and disabling the quantity field for editing.

    If any one else has experienced this issue, or has found a way to fix the code, let me know… otherwise I am continuing to seek the code that sets this limitation and disable it for now. Reading cookies is not the way to go for this tool - it should be a simple test for electronic products at checkout to make sure they are all set to quantity of 1 if they are in there at all.

Hmmm, do you have a clean copy of 2.0.12 to compare to? That would be my first thought. I’m reeeeeaaally glad I haven’t upgraded yet. My store is 100% downloads and my qty is limited to 1 for all products. It is working correctly in my 2.0.12 store. When an attempt to add a product more than once, two notifications pop up:

Maximum quantity for “Product Name” is 1


This product is already in the cart

As for where to look for the code, I’m hoping someone more familiar with that can add their thoughts, but I would start by checking the /core/fn.cart.php file to see if it changed from the previous version. Look for the instances of max_qty. I just ran a search on the store files and it looks like that file may be the one that controls that function.

This bug is tied directly to the operation of the Live Help Beta 2 experimental addon. When this addon is not active, the cart issues disappear.

To be more precise, when the live help addon is active, customers can add products to the cart, however if they do not wait 15-20 seconds before moving to another page or checking out, the products ordered may either drop out of the cart, or the inventory numbers may be short or otherwise inaccurate.

2.0.14 without the live help beta installed and running does not exhibit this bug at all.

In my limited testing under 2.0.14 + LH beta 3, items that are added to the cart from the category view disappear when going to View Cart. Add to Cart does work from the item detail page. With LH disabled, the cart functions properly.


Yeah that fits with my observations - I posted a screencast to the ticket as I believe it is a polling frequency issue. The outbound/inbound traffic from live help prevents the inventory control response from getting back to the client in a timely fashion, so the ajax add to cart button registers making the request to add the product to the cart, but it take 12-20 seconds for the client to get the response back that it the add is possible and so the client does not create the cookie on the user side of things.

If you add to cart with live help on and wait for 20-30 seconds and then checkout, enough time lapses for the async call to register the response from the server and the product appears.

I have basically moved the live help block off of product pages and limited it to the about us page and contact us page.