When I complete a payment, I am not showed the 'Thank you for your order' message: I get redirected to the /checkout/ID/complete page. But rather than showing that page, it stays blank and directly redirects to the /cart page. Which by then is of course empty.

The redirect happens with a "Location: /cart" header.

It happens using both the Manual Payment Gateway and the commerce_mollie payment gateway.

---

We need to check/reproduce the case.
We shouldn't definitely interfere with the payment process.

Comments

RandomNeighbour created an issue. See original summary.

RandomNeighbour’s picture

Issue summary: View changes
RandomNeighbour’s picture

olafkarsten’s picture

Priority: Normal » Major
Issue summary: View changes
Issue tags: +ContributionWeekend2019

thanks for taking the time to report this.

guy_schneerson’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

@RandomNeighbour I can not reproduce the issue. did you check this does not happen also without stocvk on your site?

rubenjara’s picture

I'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)

RandomNeighbour’s picture

@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.

Priyanka Singh’s picture

This happens with me also. If you have stock 1 in cart , then on checkout complete it redirects to cart.

martijn de wit’s picture

We 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.

martijn de wit’s picture

Can 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

rubenjara’s picture

This problem occurs when you have activated "Reserve stock on order complete" in the stock configuration.

jwwj’s picture

Can 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.

ahkhoon’s picture

I am facing the same issue, confirmed the behaviour described by #11 and #12.

siegrist’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new960 bytes

The 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.

rubenjara’s picture

#14 The patch works for me, thanks @Siegrist

martijn de wit’s picture

StatusFileSize
new788 bytes

Nice one Siegrist!

Added new patch where directory structure match module directory structure.

jwwj’s picture

Thanks Siegrist and Martijn de WIt! Patch in #16 worked for me as well

martijn de wit’s picture

Status: Needs review » Reviewed & tested by the community

Let's set this to reviewed by community with several +1's :)

guy_schneerson’s picture

Status: Reviewed & tested by the community » Fixed

Big 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" :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

harshadananjaya’s picture

#16 is work for me. thanks.

akalam’s picture

StatusFileSize
new1.28 KB

The 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:

  • you won't be registered
  • you will be redirected to the cart page
  • you will see the error message "One or more Items are out of stock. Checkout canceled!".

Here is a patch fixing the issue. Can a maintainer review it? thanks a lot.

akalam’s picture

I can't reopen this issue because I'm not a maintainer, so I will create a new one.

akalam’s picture

I created a child issue and attached a new patch there

guy_schneerson’s picture

Status: Closed (fixed) » Needs review
guy_schneerson’s picture

Status: Needs review » Fixed

child issue was committed a while back so marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.