0

I have a magento site in ver 2.3.5-p1

I want to redirect /checkout/cart/ this page to homepage, because my site is Quote only store and so no need of normal cart page. For that I have created a module to override Magento\Checkout\Controller\Cart\Index this controller. Then added following code in my new controller:

namespace MyCompany\RedirectShoppingCart\Controller\Cart;

class Index extends \Magento\Checkout\Controller\Cart\Index
{
    /**
     * Shopping cart display action
     *
     * @return \Magento\Framework\View\Result\Page
     */
    public function execute()
    {
        return $this->_response->setRedirect('/quotation/quote/', 301);
    }
}

But this is giving following error:

Fatal error: Uncaught TypeError: Argument 2 passed to Amazon\Login\Plugin\CartController::afterExecute() must implement interface Magento\Framework\Controller\ResultInterface, 
instance of Magento\Framework\App\Response\Http\Interceptor given, called in /var/www/html/vendor/magento/framework/Interception/Interceptor.php on line 146 and defined in /var/www/html/vendor/amzn/login-with-amazon-module/Plugin/CartController.php:44

Please help!

2 Answers 2

2

because my site is Quote only store and so no need of normal cart page.

Based on your statement above - I'm assuming that you DONT need/leverage the Amazon modules that ship OOTB with Magento 2.3.5.

If that is a valid assessment, your simplest option would be to disable the following Amazon modules:

  1. Amazon_Login

  2. Amazon_Core

  3. Amazon_Payment

And this can be achieved - via the CLI - using the following commands:

bin/magento module:disable Amazon_Login
bin/magento module:disable Amazon_Core
bin/magento module:disable Amazon_Payment

Good Luck!

Cheers,

Sharath

1
  • Hi Sharath, thanks for the answer, but is it possible to do without disabling those modules? As I don't want to make any major change sin site, instead just add that simple redirect. Please check and advise?
    – djmzfKnm
    Jun 29, 2020 at 12:32
1

You can disable this plugin. File di.xml

    <type name="Magento\Checkout\Controller\Cart\Index">
        <plugin name="amazon_login_cart_controller" disabled="true" />
    </type>

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.