PrestaShop / hummingbird

77 stars 73 forks source link

[FO] CART- the button "Add to Cart" enable while the product is out of stock #486

Open Zoefinders opened 1 year ago

Zoefinders commented 1 year ago

Describe the bug

When you add more items than in stock from product page, the message The product is no longer available in this quantity. is not displayed and the button "Add to cart" still enable.

Expected behavior

The button "Add to cart" should be disabled as the product is out of stock

Steps to reproduce

  1. BO>Create a product with stock 5
  2. FO>add up to 6 of this product
  3. See error > the button "Add to cart" is not disabled => ❌
  4. Click on the button "Add to cart"
  5. An error message is displayed => ✅
  6. The product is not add to the cart => ✅

Screen record

[Uploading hb_issueCart.webm…]()

Additional infos

ga-devfront commented 1 year ago

@Zoefinders didn't find how to reproduce this issue (we got the message, but the product is not added).

Hlavtox commented 1 year ago

@ga-devfront Maybe it was fixed with recent core changes. On develop, it doesn't get added to cart?

ga-devfront commented 1 year ago

@Hlavtox yes we tested with 8.0.2 PrestaShop and the product is not added to the cart.

tajriba commented 1 year ago

@ga-devfront hi, we can also add more products inside the cart (hummingbird+prestashop 801). I see no fixes for this in prestashop 802.

tajriba commented 1 year ago

see this. 1 product in stock. you can't order more than 1. but in the cart I can set it to 2, the tooltip appears. But it must be working like this: not possible to change quantity to 2, are at least, not stays at quantity 2 in the cart.

Scherm­afbeelding 2023-04-21 om 14 05 14
ga-devfront commented 1 year ago

After some investigation on PS 8.1.0 with Hummingbird I don't think it's a good idea to try to catch it with JS : https://www.awesomescreenshot.com/video/18043819?key=6c8e9ceb6fb32a97f89328f425c3a1d3 the add to cart button is not disabled but then we click we got the error message (on homepage and page product). If you really want it possible to handle it by JS but it require much changes and it's impossible to got the real time quantity and variation. What do you think ?

ga-devfront commented 1 year ago

After discussion with @kpodemski and @MatShir this issue need to add an API call on Core side for V9. It's not a blocking point for moment, cause the error is already handled with error message.

tblivet commented 1 month ago

I have just tested it, and it looks good. What do you think?

https://github.com/PrestaShop/hummingbird/assets/110676325/190e1c12-c648-4aeb-917e-5827eb4d5f62