Magento2 checkout/onepage/success redirects to cart

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.

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.

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="" 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"}}