How to override magento 2 order/items/renderer/default.phtml?

We can override default.phtml file using below way,
Create sales_order_item_renderers.xml in your module layout folder,
File path will be in your module,

Replace Rbj_Training with your actual module name.

Clear Cache and check your file will be overridden.

How to send image attachment with email template in magento 2

For Attach image in email template, you need to override TransportBuilder Class from Magento\Framework\Mail\Template\TransportBuilder

For Send Email Magento 2 without image attachment refer link,  Send Mail from Custom module Magento 2

For Override TransportBuilder.php file in Magento 2, you need to create di.xml file.
Using di.xml file you can override any PHP class in Magento 2.

Continue reading “How to send image attachment with email template in magento 2”

How to upgrade database table in magento 2?

When You need to add a new field in the existing table, you need to create UpgradeSchema.php file in Setup folder of your module.

We add new address field in our existing table by below way, We have just create a database table in the previous post, Create Database table in Magento 2

Run php bin/magento setup:upgrade

Now you can check your new address field is display in your create_form table.