How to keep session data on order success page so that you can work on it in magento2?
-
01-10-2020 - |
Frage
In mage1 there was $session->clear()
but cannot find where it is done in magento2?
I thought it was $this->checkoutSession->clearQuote()->clearStorage();
in
vendor/magento/module-checkout/Observer/UnsetAllObserver.php
but it's not.
Lösung
Check following file and code.
# Magento/Checkout/Controller/Onepage/Success.php
$session->clearQuote();
Andere Tipps
Another quicker way to do this is to edit the isValid()
method in
app/code/Magento/Checkout/Model/Session/SuccessValidator.php
and set an existing order id, then navigate to your success page (site.com/checkout/onepage/success)
See https://github.com/magepal/magento2-preview-checkout-success-page
$orderId = 123;
$incrementId = '000001'
$this->checkoutSession
->setLastOrderId($orderId)
->setLastRealOrderId($incrementId);
return true;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange