I'm trying to override one protected function in Magento 2 but I am not able to achieve it. I have edited following files:

  <preference for="Magento\Checkout\CustomerData\DefaultItem" type="XYZ\Checkout\CustomerData\DefaultItem" />


    namespace XYZ\Checkout\CustomerData;

    class DefaultItem extends \Magento\Checkout\CustomerData\DefaultItem

but still not working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.