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

Product inventory should update when a new order is created #4337

Closed
3 tasks done
nnnnat opened this issue Jun 18, 2018 · 7 comments
Closed
3 tasks done

Product inventory should update when a new order is created #4337

nnnnat opened this issue Jun 18, 2018 · 7 comments
Assignees
Labels
bug For issues that describe a defect or regression in the released software

Comments

@nnnnat
Copy link
Contributor

nnnnat commented Jun 18, 2018

Prerequisites

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue? Search issues

Issue Description

Currently, RC updates a product's inventory count after an admin processes an order. A product's inventory count should update when a new order is created.

Steps to Reproduce

  1. Spin up a fresh RC shop, log in as an admin and create a new product with a quantity of 2.
  2. In another browser as a customer purchase 1 of the newly created product.
  3. As an admin view the new product's quantity to see it still at 2
  4. As an admin process the new order to completion then check the new product's quantity. It should now show 1.

Possible Solution

N/A

Versions

Node: 8.9.4
NPM: 5.6.0
Meteor Node: 8.9.4
Meteor NPM: 5.6.0
Reaction CLI: 0.29.0
Reaction: 1.12.1
Reaction branch: master
@nnnnat nnnnat added needs-to-be-reproduced bug For issues that describe a defect or regression in the released software labels Jun 18, 2018
@nnnnat nnnnat added this to the Grays milestone Jun 18, 2018
@mkhizeryounas
Copy link

mkhizeryounas commented Jun 19, 2018

Quantity should not be updated on the admin side when an Sale order is created. Admin should see the actual quantity but on the customer side product’s quantity should first less the quantity of products in sale orders and show that quantity to avoid over sold products.

@spencern spencern removed this from the Grays milestone Jun 25, 2018
@spencern
Copy link
Contributor

We'll schedule this bugfix once we start to work on the GraphQL API for checkout and orders.

@brent-hoover
Copy link
Collaborator

I actually think this was "as designed", since there were concerns that the store owner "accept' the order before it reduce inventory. More likely this should be configurable.

@spencern
Copy link
Contributor

spencern commented Dec 7, 2018

This points to two separate but connected issues - as @mkhizeryounas has noted.

  1. There should be a way to track inventory levels for a product which track with the actual number of items in stock. This should not be decremented when an order is placed, but rather when the item is picked from the shelves.

  2. There should also be a way to track the number of items that are "Available To Sell" (ATS). This number should be the inventory minus the quantity of items that are in open orders and have not been picked yet.

Both of these numbers are important, and it seems that we need to add some property or method to keep track of the ATS numbers so that shops can prevent overselling.

@mkhizeryounas
Copy link

The actual inventory should not minus when an order is placed but invetory available to sell on storefront shou reflect the actual inventory - sale orders to avoid negitive order placement.

@kieckhafer
Copy link
Member

I've been working on this. PR #4859 has the solutions.

We've added a second field, inventoryAvailableToSell, which is the inventory that a customer is allowed to purchase. inventoryAvailableToSell is updated when a customer places an order.

The existing field, inventoryQuantity (called inventoryInStock` in the Catalog), stays the same, and is updated when the operator approves or cancels an order.

In the time between when a customer places an order, and the order is approved, these numbers will be different.

The operator will see an editable field for inventoryQuantity in the operator UI. The inventoryAvailableToSell will calculate itself based on this number, minus "reserved" items that a user has in an order. The operator will see a non-editable field for inventoryAvailableToSell in the operator UI.

The customer will always see inventory numbers and statuses based off the inventoryAvailableToSell number.

@kieckhafer
Copy link
Member

Closed via #4859

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For issues that describe a defect or regression in the released software
Projects
None yet
Development

No branches or pull requests

5 participants