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

[DFC Orders] - Order Cancellations not recalculating correctly #13046

Open
RaggedStaff opened this issue Dec 18, 2024 · 6 comments · May be fixed by #13044
Open

[DFC Orders] - Order Cancellations not recalculating correctly #13046

RaggedStaff opened this issue Dec 18, 2024 · 6 comments · May be fixed by #13044
Assignees

Comments

@RaggedStaff
Copy link
Collaborator

Description

Whilst testing #13044 I encountered a bug in the back order recalc following an order cancellation.

Shopify Draft order
OFN Cancelled Order

Expected Behavior

Only the necessary product (1 x case of 6 x Balsamic vinegar 40ml) should be removed from the back order following an order cancellation.

Actual Behaviour

Several other products, not related to the cancelled order where removed (see screenshots)

Steps to Reproduce

  1. set up a test OC
  2. Put in an order to match R816347760
  3. confirm draft order created in Shopify test store
  4. put in a further order for 1 x 40 ml balsamic vinegar
  5. confirm no update to draft order in Shopify
  6. put in an order for 2 x 40ml balsamic vinegar
  7. confirm 2nd case added to draft order in Shopify
  8. cancel order for 1 x 40ml balsamic
  9. Check draft order in Shopify

Animated Gif/Screenshot

Screenshot from 2024-12-18 08-39-55
Screenshot from 2024-12-18 08-35-26
Screenshot from 2024-12-18 08-35-16
Screenshot from 2024-12-18 08-33-11
Screenshot from 2024-12-18 08-31-18

image

Workaround

Not that I can think of.

Severity

bug-s2: a non-critical feature is broken, no workaround

Your Environment

  • Version used:
  • Browser name and version: Chromium
  • Operating System and version (desktop or mobile): Ubuntu 22.04.5

Possible Fix

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

I'm not sure your expectation is the desired logic:

Only the necessary product (1 x case of 6 x Balsamic vinegar 40ml) should be removed from the back order following an order cancellation.

Since many things can influence the backorder, we discussed always doing a complete re-calculation for all items. For example, stock could have been adjusted in the OFN backend. Thinking about possible causes for more items being removed:

  • An on-demand product could have increased stock levels so that a backorder is not needed any more. This could happen when an unrelated order is cancelled or the stock level is adjusted manually.
  • The product is removed from the order cycle.

Another thing I noticed is that you mixed retail and wholesale variants in the same order cycle. I thought that's not a scenario at the moment? It should work but I haven't tested it at all. I just wonder how the retail variants got added to the backorder. If there's a mapping between the variants then OFN would always try to order the wholesale variant.

I'll try to reproduce your scenario now.

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

Now I'm also seeing that there are two retail variants for the balsamic vinegar. So far I always assumed one retail variant mapped to one wholesale variant. I need to check implications.

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

Put in an order to match R816347760

I now noticed that the Dulse flakes don't appear in the shopfront. The stock level is 0. In Shopify the Case, 10 x 30g variant doesn't have stock either. That's probably why it got removed from the Shopify order.

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

put in a further order for 1 x 40 ml balsamic vinegar
confirm no update to draft order in Shopify

I do see an update here. The 40 ml bottle and the 100 ml bottle are both listed in Shopify as two separate items. I need to check the transformation to wholesale. Are the mappings on at the moment?

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

cancel order for 1 x 40ml balsamic
Check draft order in Shopify

I can confirm that the Dulce flakes were removed again. Interestingly, the OFN stock for the wholesale Dulce flakes was reduced by one. That seems to be a mix-up. My theory is this:

  • Customer orders retail flakes.
  • Backorder for wholesale flakes are is placed.
  • On order amendment or order completion we go through all linked variants of the order cycle.
  • We look at the retail flakes and everything is correct.
  • We look at the wholesale flakes and see that there are some in the backorder even though nobody ordered wholesale flakes. We remove it.

So the error is that we have been looking at each item one-by-one instead of accumulating wholesale and retail together. We are not dealing with mixing them yet. Is this a scenario we need to support?

In any case, this is not a regression of Remove old, replaced backorder lookup #13044. This is pre-existing.

@mkllnk
Copy link
Member

mkllnk commented Dec 19, 2024

Clarifying the vinegar confusion. Test instructions were:

  • Put in an order to match R816347760
  • the above adds a 100ml vinegar bottle which is not mapped to a wholesale variant
  • confirm draft order created in Shopify test store
  • put in a further order for 1 x 40 ml balsamic vinegar <- this is the first time adding the 40 ml retail variant for vinegar
  • confirm no update to draft order in Shopify <- there is a change adding this variant to the order
  • put in an order for 2 x 40ml balsamic vinegar <- now we are at 3 * 40ml which fit into one six pack
  • confirm 2nd case added to draft order in Shopify

I think that those instructions need updating because there's something wrong in the setup. Did you intend to add the 40ml bottle in the first place? And how many? We need to order more than six to reach a second case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Status: All the things 💤
Development

Successfully merging a pull request may close this issue.

2 participants