You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, we do not recalculate inventory if customer(s) added their products to the cart. So we have two business cases which uncovered on our system:
Product has available quantity = 5, customer add 5 to cart, product still have available quantity 5, customer can add yet another 5 to cart (totally 10 in single cart)
Product has available quantity = 5, customer A add 5 to cart, product still have available quantity 5, customer B can add yet another 5 to cart (totally 10 in two carts)
Proposal:
Use currently non-used ReservedQuantity to store information about reservations
Add AdjustInventoryCartChangedEventHandler in the Cart module. Set Reservation to delta between previous and current quantity of product in the cart
AdjustInventoryCartChangedEventHandler should use same workaround with Hangfire as we do AdjustInventoryOrderChangedEventHandler in order to prevent data inconsistency because of concurrence
We don't need to extend AdjustInventoryOrderChangedEventHandler because cart is deleting as part of order creation process
On storefront we need to calculate AvailableQuantity of product as InStockQuantity - ReservedQuantity
We need to add expiration mechanism for reservations. Still be open question. Proposal:
6.1. Add expiration time property to cart object
6.2. Move inventory adjustment method to separate singleton service with race tracing protection using Hangfire
6.3. Call inventory adjustment when cart changes or by recurrent hangfire job with configurable time
The text was updated successfully, but these errors were encountered:
@kamilgarey commented on Tue Apr 23 2019
Available quantity should be equal to InStockQuantity - ReservedQuantity(Sum of all quantities that placed to shopping cards).
@kamilgarey commented on Tue Apr 23 2019
I'll make PR for this.
Currently, we do not recalculate inventory if customer(s) added their products to the cart. So we have two business cases which uncovered on our system:
Proposal:
6.1. Add expiration time property to cart object
6.2. Move inventory adjustment method to separate singleton service with race tracing protection using Hangfire
6.3. Call inventory adjustment when cart changes or by recurrent hangfire job with configurable time
The text was updated successfully, but these errors were encountered: