cancel
Showing results for 
Search instead for 
Did you mean: 

Order success page redirecting to cart after checkout

Highlighted

Re: Order success page redirecting to cart after checkout

Hi guys,

I am facing this issue too on Magento CE 2.3.1. I have put the log everywhere since the issue happened.

I can see if using a payment method (currently using Cybersource SecureAcceptance) which will redirect the customer to a payment site and redirect back to Magento store. When it returns and calling successValidator to check isValid(). The session object was another different one so It couldn't get anything about the LastSuccessQuoteId and redirect the customer to cart page as the code described in Magento core.

if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) {
return $this->resultRedirectFactory->create()->setPath('checkout/cart');
}

 

Anyone using the same payment method or same kind of payment method facing this issue and resolve it yet? 

 

Cheers,

Highlighted

Re: Order success page redirecting to cart after checkout

Hi @vanimilk 

 

I had same issue with Authorize.net payment gateway. I would like to check if you are using sandbox account and your website is on secure server with HTTPS. If not most of the time we face this kind of issues.

 

So I would like to recommend, make sure your website is on HTTPS and in case if you are using any custom code you need to make sure that your cart session is not clear before order success page or immediate after click on place order.

 

Thanks 

 

--
If my answer is useful, please Accept as Solution & give Kudos

Highlighted

Re: Order success page redirecting to cart after checkout

I have the same issue with the paypal plus extension of i-ways. The checkout session exists in their controller class create.php. After creating the order, the execute method redirects to checkout/onepage/success. In this controller, the checkout session is empty. 

Is there any solution for this problem?

Highlighted

Re: Order success page redirecting to cart after checkout

I tried to understand the storage behavior for the checkout session with additional log entries and Redis Monitor.
As long as the full page cache is disabled, reading and saving the session context in Redis is as expected.

If the full page cache is enabled, the behavior becomes strange.
The checkout session context is loaded from Redis and locked. The data is available in the controller and can be changed there and the changes can be read again from the Session Object.
After termination, the session context is written to Redis again. However, the previous version. The changes made in the meantime are ignored.

I have added a checkoutSession.start() as work arround and explicitly set the relevant attributes for the success page. Now the object is saved in Redis again and the confirmation page is displayed as expected.

Highlighted

Re: Order success page redirecting to cart after checkout

It surely issue with third party module or custom module. So Disable the third party extension and custom module one by one and check the place order flow.

 

Then you can find where issue come from.

 

cheers

Highlighted

Re: Order success page redirecting to cart after checkout

It's not third party in my case, I have checked all observers on order place after, and checked the session in xdebug, it is set, then when it redirects to onepage/checkout/success, there is no last_success_quote_id in this checkout session, so user gets sent to cart, but the order is placed successfully and all backend is correct, just gets wrongly redirected here. Disabling full page cache and it works correctly, but not a good long term fix. It's likely due to some change in depersonalization with FPC, amazon pay is using order management placeOrder method, which still uses the same classic way of setting these values in session, but it is not retained on redirect. I have also checked that session id is the same across the requests.

 

I'm seeing this issue with amazon pay on 2.3.2

Highlighted

Re: Order success page redirecting to cart after checkout

thanks man @markus_korporal , you led me in the right direction.

 

Success page shouldnt be in FPC, and it isnt by default (hence i wasnt thinking about it at all).

But we made preference for Onepage\Success block.

 

And while everything else worked, layout definition in checkout_onepage_success.xml had specified no caching for original block, and not ours.

 

Specifying no caching for our block in layout removed the issue.

 

Hope this saves smnes hair over this.

Highlighted

Re: Order success page redirecting to cart after checkout

Unfortunately in my original issue FPC had nothing to do with it. Even with FPC and block_cache disabled we still faced the same issue. Even with all caches disabled we faced the same issue. Still have no idea what fixed it

Highlighted

Re: Order success page redirecting to cart after checkout

i have also the error, can somebody help? It with the normal Payments of magento2 also with paypal plus.

Highlighted

Re: Order success page redirecting to cart after checkout

I struggled with this problem for 3 days, then I realized it was due to the setting Shop-> Configuration-> Sales-> Sales Email-> Send Order Email Copy To. I had added a second email, and perhaps due to an incorrect character this problem occurred.