Magento2にすでにある機能を継承して動きを変えたい場合があります。
その場合は、モジュールを作成し、etc/di.xml ファイルにpreferenceを指定すればできるようです。
app/code/Yassujp/HelloWorld/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\Catalog\Model\Product" type="Yassujp\HelloWorld\Model\Product" /> </config>
参考