once we click on logout link, I need to be redirected to cart page /catalog page not home page,how can I proceed to do so.
Thank you

1 Answer 1


create "customer_account_logoutsuccess.xml" file in "vendorName/moduleName/view/frondend/layout"

write following code in this file.

 <?xml version="1.0"?>
  <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
                    <referenceContainer name="content">
                        <block class="Magento\Framework\View\Element\Template" name="customer_logout" template="vendorName_moduleName::logout.phtml"/>

create logout.phtml file in "vendorName/moduleName/view/frontend/templates"

<p><?= $block->escapeHtml(__('You have signed out and will go to our homepage in 5 seconds.')) ?></p>
    <script type="text/x-magento-init">
            "*": {
                "Magento_Customer/js/logout-redirect": {
                    "url": "<?= $block->escapeJs($block->escapeUrl($block->getUrl('checkout/cart'))) ?>"

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.