When I use PayPal Plus(PayPal, credit cards) ,the checkout success page is not shown. Instead is redirected to checkout/cart/. enter image description here

The redirection happens in this file:


 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
namespace Magento\Checkout\Model\Session;

 * Test if checkout session valid for success action
 * @api
class SuccessValidator
     * @var \Magento\Checkout\Model\Session
    protected $checkoutSession;

     * @param \Magento\Checkout\Model\Session $checkoutSession
     * @codeCoverageIgnore
    public function __construct(
        \Magento\Checkout\Model\Session $checkoutSession
    ) {
        $this->checkoutSession = $checkoutSession;

     * @return bool
    public function isValid()

        if (!$this->checkoutSession->getLastSuccessQuoteId()) {
            return false;

        if (!$this->checkoutSession->getLastQuoteId() || !$this->checkoutSession->getLastOrderId()) {
            return false;
        return true;

I found out that all three :

$this->checkoutSession->getLastSuccessQuoteId() $this->checkoutSession->getLastQuoteId() this->checkoutSession->getLastOrderId() return null. Obviously there is something to do with the session but this is the furthest I could go. The orders are completed and successful.Its just the order confirmation page that is not shown.

  • Did you check the log? Is there any error? Nov 24 '18 at 6:45
  • @KhoaTruongDinh There is no error..
    – glafche
    Nov 26 '18 at 9:08
  • confirm log is enable from admin? And the payment method also provide the options of debug. Enable that option and then check log folder. Nov 26 '18 at 14:10
  • @DhirenVasoya there are no errors
    – glafche
    Nov 26 '18 at 14:23
  • You may go through these fixes for better understanding. stackoverflow.com/questions/5417419/…
    – Ajwad Syed
    Nov 27 '18 at 12:56

Look very carefully to your var/log/system.log.

In my case, I was missing some important information there and the problem was Redis. The session was being locked by some other process and didn't allow Magento to update the cart/quote session there.

I just noticed that when added a breakpoint to \Magento\Checkout\Controller\Onepage\Success::execute and looking at my tail -f var/log/* terminal tab.

Update: I faced the problem again and Redis config was the problem. I just changed the break_after_frontend from 5 to 15 in app/etc/env.php as I described here. It worked for me.


This was with us after the PayPalPlus order, because of the static block in the email template.

instead of this in email template:

{{block cacheable="false" id="terms"}} <!-- cacheable not working -->

I created sales_email_order_terms.xml in Custom_Theme/Magento_Sales/layout.

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Terms" design_abstraction="custom">
        <block class="Magento\Cms\Block\Block" name="block_email_terms" cacheable="false">
                <argument name="block_id" xsi:type="string">terms</argument>

and then use in email template:

{{layout handle="sales_email_order_terms"}}
  • Your solution worked for me, and I guess @paj has gave proper explanation.
    – Knight017
    Jan 3 '21 at 15:03

I found a solution.

The problem was that


Somehow were lost before paypal redirects to /checkout/onepage/success.

When the order is created, I pass the id of the order to the /checkout/onepage/success. Than I:


At this point, everything works fine.

  • 1
    Just a note about this as I just had the issue myself while working on a payment integration: if you play with orders, validating them, debugging order state & so on it might happen that you go through a state when Magento will clear the last successful quote ID and so on; however it might be just a transient state issue, and once you play out your full payment workflow from start to finish, it'll work out well. Dec 17 '18 at 2:12
  • @Borche Glafche can u share details file path..
    – matinict
    Feb 25 '20 at 11:18
  • @matinict you can find Success.php at vendor/magento/module-checkout/Controller/Onepage/. There you can see the redirect function. The edits glafche is suggesting you can do at vendor/magento/module-checkout/Model/Session/SuccessValidator.php.
    – TheFrakes
    Aug 25 '21 at 9:53

If you use blocks in your email templates to load content from cms or phtml templates into new order emails this can cause an issue where the call to the block destroys the customer session when the new order email is sent. This means when you return to the site after successful third party payment i.e. PayPal there is no session data and the customer is redirected to an empty cart.

  • Wow, this really helped me out, since I was facing this issue with paypal plus and logged in customers. Do you know how to prevent this? I want to add the block back to my email order template...
    – TheFrakes
    Jul 30 '21 at 12:35

Ok, so we had the same problem, after card payment on PG instead of landing on success page there was a redirect to empty cart (order was successful).

Reason was session was cleared as well. Main cause for that happen to be full_page cache being flushed.

Why that happened, since that page shouldn't be in fpc? Well, magento and its fantastic di system.

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.

Hopefully smne will not lose same amount of time and life as i did.

  • Thanks @CT. This was the only solution that worked for me. Feb 4 '20 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.