0

How to override

vendor/magento/module-catalog/Pricing/Price/TierPrice.php ?

in magento 2

0

In Magento2 You can overwrite using below code

create di.xml in your module

<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\Catalog\Pricing\Price\TierPrice" type="Vendor\Module\Pricing\Price\TierPrice" />
</config>
  • Thanks for your help, Can you please share complete code to override the TierPrice ? – Raju Patel Mar 29 '18 at 10:57
0

Create custom module app/code/Vendor/ModuleName and override that class using dependency injection, in reference Override Classes in Magento 2 you will find detailed step info to do this job :

important part is "To make sure we have the right order of module dependencies, etc/module.xml should have defined module sequence ..."

For Module sequence read below dev docs article.

http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/module-load-order.html

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.