3

I want to override a core plugin in Magento\Sales\Controller\Order\Plugin -> Authentication.php

Is this even possible to achieve ?

2 Answers 2

1

I would advise againts overriding the plugin, but adding your own plugin to that plugin and do your customisation that way. This way you avoid future errors.

2
  • How will we achieve it ?
    – Tanmay
    Oct 14, 2020 at 15:51
  • The same way as @RK Rathod has but without disabling the core plugin.Just add your own plugin to Magento\Sales\Controller\Order\Plugin\Authentication Oct 15, 2020 at 7:18
3

After disable core plugin you can override

Vender\Module\etc\di.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Sales\Controller\Order\Plugin\Authentication">
        <plugin name="authentication" disabled="true" />
        <plugin name="vender_module_authentication" type="Vendor\Module\Controller\Order\Plugin\Authentication" sortOrder="60" disabled="false"/>
    </type>
</config>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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