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

OCC-199: Prevent checking out if there are unavailable products in the cart #377

Merged
merged 18 commits into from
Nov 20, 2023

Conversation

porgabi
Copy link
Contributor

@porgabi porgabi commented Nov 11, 2023

OCC-199
Fixes #375

# Conflicts:
#	src/Modules/OrchardCore.Commerce/Services/PaymentService.cs
#	src/Modules/OrchardCore.Commerce/Services/ShoppingCartHelpers.cs
#	src/Modules/OrchardCore.Commerce/ViewModels/CheckoutViewModel.cs
#	src/Modules/OrchardCore.Commerce/Views/ShoppingCart/Index.cshtml

This comment has been minimized.

@porgabi porgabi marked this pull request as ready for review November 13, 2023 15:44
@sarahelsaig
Copy link
Contributor

I found a way to still reproduce the original error. If you set the inventory of Test Free Product (which allows back-order) to 0 and try to check out you still get the "Inventory value cannot be negative." error.

@porgabi
Copy link
Contributor Author

porgabi commented Nov 15, 2023

I found a way to still reproduce the original error. If you set the inventory of Test Free Product (which allows back-order) to 0 and try to check out you still get the "Inventory value cannot be negative." error.

Looks like the allows back order value is not properly taken into account during checkout. How should this work when the inventory still has items available and back ordering is allowed -- inventory should be decreased as normal, right? As long as it doesn't go below 0, that is.

@sarahelsaig
Copy link
Contributor

I found a way to still reproduce the original error. If you set the inventory of Test Free Product (which allows back-order) to 0 and try to check out you still get the "Inventory value cannot be negative." error.

Looks like the allows back order value is not properly taken into account during checkout. How should this work when the inventory still has items available and back ordering is allowed -- inventory should be decreased as normal, right? As long as it doesn't go below 0, that is.

Yeah, inventory should still be decreased. I think you just have to change this line to also take inventoryPart.AllowsBackOrder into consideration

@sarahelsaig sarahelsaig merged commit c47329e into main Nov 20, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prevent checking out if there are unavailable products in the cart (OCC-199)
2 participants