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

Backoffice orders: Item counter accepts values higher than the available stock, which may lead to incorrectly charged orders #5989

Closed
filipefurtad0 opened this issue Sep 3, 2020 · 5 comments · Fixed by #6098 or #6658
Assignees
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.

Comments

@filipefurtad0
Copy link
Contributor

filipefurtad0 commented Sep 3, 2020

Description

It is possible to introduce a number of items above the available stock, when orders are placed in the backoffice. This may lead to charging of higher amounts than the amounts available for shipping, leading to discrepancies between the information seen in the backoffice and that which reaches the customer.

I think it's easier to see this in two parts:

  1. the item counter in the backoffice orders
  2. the creation of orders which charge the incorrect amount

Expected Behavior

  1. The item counter should not accept values higher than the available stock, for that specific product.
  2. The values charged in the order should match their actual value. If more was charged, then the order should have an orange-colored "Credit Owed" state, instead of green "Paid".

Actual Behaviour

  1. If added in a stepwise manner, the item counter in backoffice orders accepts values higher than the available stock, for that specific product.
  2. If unaware of 1) the user may place an order which charges value higher than its real cost

Steps to Reproduce

Part 1)

  1. Set a product in an open order cycle with available stock = 2, for example.
  2. Go to the Orders page and create a new order
  3. First, add two items from that product
  4. Then, add items to the order, one by one - see the gif - till you have 5 items, for example. Notice the counter works correctly if you try to add 10 items, when only two are available.

Part 2)

  1. Add customer details. At this point, you may go back to "Order details" and click "Update and recalculate fees". Observe that the stock is updated, but the value of the order isn't.
  2. Proceed to Payments and checkout, for example, with Stripe
  3. Go back to Order Details -> although the order is shown as Complete, notice that the amounts from the purchased items and the actually charged amount not match: 2 items were available, 5 items were charged. In Bulk Order Management, check that the status of the order is all green: "Credit Owed" is not showing
  4. If possible, check that the customers order confirmation includes 5 items, and not 2. The value for 5 items was charged.
  5. Check the Stripe account and verify that the amount on the customers confirmation order was indeed charged.

Animated Gif/Screenshot

Part 1)
tricky_stock

Part 2)

image

image

image

image

image

Workaround

  • If the user notices that the order value does not match the amount to be charged, then the workaround would be to drop that order and start a new one
  • Cancelling that order, returning the paid amounts to the customer, and placing another one

Severity

Proposing a bug-s3: a feature is broken but there is a workaround

Your Environment

  • Version used: v3.4.5
  • Browser name and version: Firefox 80
  • Operating System and version (desktop or mobile): Desktop Ubuntu 20.04

Possible Fix

@filipefurtad0 filipefurtad0 added the bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround. label Sep 3, 2020
@brymut
Copy link
Contributor

brymut commented Sep 24, 2020

Hi, if no one has started checking this out, I'd like to give it a go.

@sigmundpetersen
Copy link
Contributor

Thanks @brymut , please go ahead! 🎉
Don't hesitate to ask if you have any questions!

@brymut
Copy link
Contributor

brymut commented Sep 25, 2020

I've gone through the user guides and can confirm/reproduce the 2 parts of the problem reported. Now having a look through the code to try prototype a possible solution.

@brymut
Copy link
Contributor

brymut commented Sep 28, 2020

Hi @sigmundpetersen , I've started on a draft PR that I think can introduce some client-side validation to solve for part 1, but still need to work out part 2.

@filipefurtad0
Copy link
Contributor Author

While testing PR #6098 I've found it to be still possible, to add items above available stock, and trigger the whole fail cascade of orders with wrong values by typing stock values (instead of using the arrows):

Peek 2021-01-13 18-29

There was already an improvement so, maybe severity could be lowered?

Matt-Yorkley added a commit that referenced this issue Jan 13, 2021
Fix #5989 Item counter accepts higher amount than available stock
andrewpbrett added a commit that referenced this issue Jan 21, 2021
Further fix #5989 (Item counter accepts values higher than the available stock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-s3 The bug is stopping a critical or non-critical feature but there is a usable workaround.
Projects
None yet
3 participants