Closed (fixed)
Project:
Commerce Stock
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Jan 2019 at 17:24 UTC
Updated:
12 Jul 2021 at 12:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
RandomNeighbour commentedComment #3
RandomNeighbour commentedComment #4
olafkarsten commentedthanks for taking the time to report this.
Comment #5
guy_schneerson commented@RandomNeighbour I can not reproduce the issue. did you check this does not happen also without stocvk on your site?
Comment #6
rubenjara commentedI'm having this error, it happens when you only have one quantity in stock of some product. When you select Pay and complete the purchase, redirect to the shopping cart.
Location: /checkout/61/complete
Referring: /checkout/61/review
RuntimeException: Failed to start the session because headers have already been sent by vendor/symfony/http-foundation/Response.php" at line 1286. Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start() (line 141 /vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php)
Comment #7
RandomNeighbour commented@guy_schneerson yes, as the problem vanished when moving to commerce_simple_stock.
@rubenjara Exactly this was my case as well. Items went to 0 in stock with the current transaction.
Comment #8
Priyanka Singh commentedThis happens with me also. If you have stock 1 in cart , then on checkout complete it redirects to cart.
Comment #9
martijn de witWe experience the same issue. ( we have enabled commerce_stock_enforcement)
For example;
There is a product with 3 items in stock. 2 people are trying to buy the product twice. So only 1 succeed and the sock level will drop to 1. The other customer gets a message that he only can buy 1 item. If he proceed to buy that 1 item, the checkout flow is redirecting him to an empty cart.
--edit
An other use case:
2 items are in stock. 1 customer buys last 2 items. After buying the 2 items, the user is redirected to the empty cart page. Not to the thank you page.
Comment #10
martijn de witCan this issue be related to the technical effect of: "Commerce stock enforcement not properly mapping cart rows to order items" ?So commerce thinks the user is still busy with the cart?edit--
not relevant anymore
Comment #11
rubenjara commentedThis problem occurs when you have activated "Reserve stock on order complete" in the stock configuration.
Comment #12
jwwj commentedCan confirm the behavior when the following is true:
1. Stock level for product variation is = 1
2. "Reserve stock on order complete" is active
If either of the above is not true then the checkout works as expected, i.e. I see the order complete page.
Comment #13
ahkhoon commentedI am facing the same issue, confirmed the behaviour described by #11 and #12.
Comment #14
siegristThe stock gets recalculated after the order completion.
The Problem is in the form_alter of the enforcement module, which checks the the stock on each form build and there for as well in the last pane when the order already has been completed. At this point the stock is not already reduced and therefore the validaten will fail, resulting in the redirect.
Comment #15
rubenjara commented#14 The patch works for me, thanks @Siegrist
Comment #16
martijn de witNice one Siegrist!
Added new patch where directory structure match module directory structure.
Comment #17
jwwj commentedThanks Siegrist and Martijn de WIt! Patch in #16 worked for me as well
Comment #18
martijn de witLet's set this to reviewed by community with several +1's :)
Comment #20
guy_schneerson commentedBig thanks to everyone who helped.
@jwwj followed your instructions and was able to recreate.
@Siegrist - Reading your explanation made it all make sense.
@Martijn de Wit - thanks for helping to push this. It does help to c the "Reviewed & tested by the community" :)
Comment #22
harshadananjaya commented#16 is work for me. thanks.
Comment #23
akalam commentedThe issue still happen on some situations.
For example if you enable the "Email registration guest registration after checkout" checkout flow pane, when you are purchasing a product with stock level 1, once you try to register you will experiment the following behavior:
Here is a patch fixing the issue. Can a maintainer review it? thanks a lot.
Comment #24
akalam commentedI can't reopen this issue because I'm not a maintainer, so I will create a new one.
Comment #25
akalam commentedI created a child issue and attached a new patch there
Comment #26
guy_schneerson commentedComment #27
guy_schneerson commentedchild issue was committed a while back so marking as fixed.