I want to override
vendor/magento/module-catalog/Pricing/Price/FinalPrice.php
with constructor argument.
Note : File overriding is working fine but when I create constructor in the overridden file it is giving me an error.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI want to override
vendor/magento/module-catalog/Pricing/Price/FinalPrice.php
with constructor argument.
Note : File overriding is working fine but when I create constructor in the overridden file it is giving me an error.
You need to pass parent constructor with your original class argument vendor/magento/module-catalog/Pricing/Price/FinalPrice.php
like
class A {
public function __construct(Abc $abc){
}
}
class B extends A {
public function __construct(Abc $abc,Xyz $xyz){
parent::__construct($abc);
}
}