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

Inaccurate Insufficient Stock Error in Checkout Flow: Unable to place multiple order for the same product #1175

Open
supreetha789 opened this issue Jan 24, 2024 · 5 comments

Comments

@supreetha789
Copy link

We are currently experiencing an issue in the Saleor version 3.17.2 checkout flow related to the creation of orders. Specifically, when attempting to create an order for a product that has a previously placed but unfulfilled order, the system returns an "insufficient stock" error, even when there is available stock according to the Checkout create response.

Steps to Reproduce:

  1. Place an order for a product.
  2. Do not fulfill the order.
  3. Attempt to create a new order for the same product.

Expected Behavior:
The system should allow the creation of a new order for a product, as long as there is available stock according to the Checkout create response.

Actual Behavior:
An "insufficient stock" error is encountered, despite the availability of stock in the Checkout create response.

Screenshots:

  • CheckoutLineProblemInsufficientStock in checkoutcreate/checkoutLinesUpdate mutation screenshot:

image

  • Product variant with track inventory enabled:

image

Environment:
Saleor Core Version: 3.17.2

Additional Information:
This issue does not occur when there is no previous order for the product, and the Allocation is 0.

Note:
We have a single channel and a single warehouse in our configuration.

@szczecha
Copy link
Member

Hi supreetha789, I have an extra question if the shipping/billing addresses for these orders the same? I mean the country.

@supreetha789
Copy link
Author

Hi @szczecha
Yes the shipping and billing address was same for all these orders (country: France).

@szczecha
Copy link
Member

supreetha789 I am having trouble reproducing your issue.
I have configured an example store:
warehouse A:

  • address: US
  • warehouse: public
  • pickup: disabled

channel A:

  • active
  • warehouse A
  • shipping A
  • country: US
  • Allocation strategy: Highest stock

shipping A:

  • country US
  • channel A
  • warehouse A

product

  • channel-a: published, available, unhidden

variant:

  • available on the channel
  • tracking inventory true
  • stock: warehouse A qty: 10

By following the steps, I can create a second order.
The only scenario in which I get InsufficientStock in checkout.line.problems is when I use a different shipping address that does not match the country from my store's shipping configuration. Can you spot the differences between my config and yours?

@supreetha789
Copy link
Author

@szczecha The only difference I can spot in the configuration is that Allocation strategy: Prioritize warehouses by sorting order.
Will this configuration affect when I have a single warehouse?

@szczecha
Copy link
Member

@supreetha789 Ok, I think I reproduce the issue but with diffrent quantities.

Variant:

  • track inventory true
  • stock warehouse A qty: 8
  1. run checkoutCreate varinat qty 1, addresses US, valid email
  2. run checkoutDeliveryMethodUpdate with shipping method id
  3. run checkoutPaymentCreate
  4. run checkoutComplete
  5. run checkoutCreate varinat qty 1, addresses US, valid email
    Result: checkout created and checkout.problems is empty
  6. run checkoutCreate varinat qty 6, addresses US, valid email
    Result: checkout created and checkout.problems shows CheckoutLineProblemInsufficientStock
"problems": [
                            {
                                "__typename": "CheckoutLineProblemInsufficientStock",
                                "availableQuantity": 5,
                                "line": {
                                    "id": "Q2hlY2tvdXRMaW5lOmYzNDZhMzg3LTI1YjUtNDE1My04NTYwLWJkNWQxMzgwOTkzNQ=="
                                },
                                "variant": {
                                    "id": "UHJvZHVjdFZhcmlhbnQ6MTE5Ng==",
                                    "quantityAvailable": 7
                                }
                            }
                        ],

Thanks for reporting

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

No branches or pull requests

2 participants