vuestorefront-community / vendure

Vue Storefront 2 integration for Vendure
https://docs.vuestorefront.io/vendure/
MIT License
72 stars 51 forks source link

[Bug]: Cart behaving wiredly.......... #223

Closed skilltimate closed 2 years ago

skilltimate commented 2 years ago

Expected Behavior

When we add products normally they should be added to cart. If the product is out of stock it should either show error or not allow to add to cart.

Actual Behavior

There are two products in the following url:

http://95.111.193.127:4000/category/sarees/bridal-silk-sarees

when u try to add the product to cart, it adds and works normally.

But when you try to add second product then the first product which was added gets deleted from the cart. The second product is out of stock, either we can disable cart button and add a label saying out of stock somewhere or entirely remove cart button and add a label "Out Of Stock"

Possible Solution

No response

Steps to reproduce

No response

What version of vendure integration are you using?

Latest

What version of Node.js are you using?

Latest

What browser (and version) are you using?

Firefox

What operating system (and version) are you using?

Windows 10

Relevant log output

No response

Code of Conduct

Baroshem commented 2 years ago

Hey @anytimewp

This kind of issue can be easily solved on the frontend. You can just set a button state to disabled when a product is out of stock. There is no need to implement this feature by default on rhe integration side as there are some stores (dropshipping) that accept adding products to cart that are out of stock.

michaelbromley commented 2 years ago

One small point re the dropshipping use-case: Vendure has the concept of "out of stock threshold" which allows you to explicitly allow ordering when there are no more in stock, so e.g. if you set the threashold to -20 it means that Vendure will still consider the product "in stock" until the quantity on hand is -20.

So if Vendure says it's out of stock, it basically won't add it to the order. In this case the storefront should display an error message (I'm not sure whether it already does or not).

Baroshem commented 2 years ago

@michaelbromley I dont think that in VSF we are handling somehow this use case. However it is easily fixable of the theme (frontend). Just disable th add to cart button when stock is below certain amount so I dont think that this is needed to be implemented on the integration side by default

Baroshem commented 2 years ago

Closing the issue as it can be solved easily on the frontend and does not need to be implemented on the integration side