Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of stock products are entering into the checkout #389

Open
curiosport opened this issue Dec 12, 2024 · 1 comment
Open

Out of stock products are entering into the checkout #389

curiosport opened this issue Dec 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@curiosport
Copy link

I'm watching the demo and I could verify that when a product is out of stock it is still being added to the checkout, shouldn't the plus button be blocked or the product be removed from the list?

If this is not a bug and it is intentional please at least add it as an option in the configuration to disable this behavior.

@curiosport curiosport added the bug Something isn't working label Dec 12, 2024
@curiosport curiosport changed the title Out of stock products are entering the checkout Out of stock products are entering into the checkout Dec 12, 2024
@ninjahza
Copy link

ninjahza commented Jan 27, 2025

I fixed this in 0.4.x by

  • storing the managed_stock flag on each cached object
  • doing an additional check stock api call to wc api on each add to cart catering for simple, variable and bundle (custom)
  • deny action on less than 0 (avail stock - requested stock)

This ensures that the true stock count never comes from cache on add to cart. It does fix 99% of race conditions.

it it not the perfect solution , but has helped me.
(2 in-store location pos and ecomm website running off a single woocommerce instance)

Having an action avail in the plugin to hook into that check would also allow for custom extentions, like bundles (which there are many of, you cant cater for them all)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants