I override the braintree module after that I'm getting this error. can anyone help me.

Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Braintree\Block\Paypal\Button
  • please add your code Apr 3, 2019 at 5:38
  • I just override the app/code/Magento/Braintree/Model/Ui/ConfigProvider.php file only Apr 3, 2019 at 5:51

1 Answer 1


In your custom module, app/code/Module/Namespace/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">
    <preference for="Magento/Braintree/Model/Ui/ConfigProvider" type="your/file/path" />

Then place the ConfigProvider.php in Module\Namespace\Model\Ui\ path.

Then in that file rewrite,

namespace Module\Namespace\Model\Ui;

 * Class Form

class ConfigProvider extends \Magento\Braintree\Model\Ui\ConfigProvider

    public function YourFunction()
          #your code

  • rewrite the file but error displaying in cart page Apr 3, 2019 at 5:57

Your Answer

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

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