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 – Rk Rathod Apr 3 '19 at 5:38
  • I just override the app/code/Magento/Braintree/Model/Ui/ConfigProvider.php file only – venkata prasad Apr 3 '19 at 5:51

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

| improve this answer | |
  • rewrite the file but error displaying in cart page – venkata prasad Apr 3 '19 at 5:57

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.