How to create a plugin for after Place Order action checkout Magento 2?

You can create a plugin for after Place order action in Magento 2 using afterPlace() plugin method.

When you required to check or get data after place order in Magento 2 or save data to other tables after place order successfully You can use afterPlace plugin from OrderManagementInterface interface’s place() method.

place() method from the Magento\Sales\Api\OrderManagementInterface interface class used to Place order operation in Magento 2 from checkout page. Continue reading “How to create a plugin for after Place Order action checkout Magento 2?”

How to add column in sales_order table using db_schema.xml Magento 2?

You can add a new column in sales_order table using db_schema.xml under your module etc folder from Magento 2.3 and Upper version.

We try to add a new column called order_country in sales_order table.

To add order_country field in sales_order table, you need to only add one row inside the db_schema.xml file structure.

Here, the Main table for Sales Operation is sales_order and you can add a new field in sales_order table by the below way, Continue reading “How to add column in sales_order table using db_schema.xml Magento 2?”

How to Get Last Order id in Magento 2?

Magento 2 Get Last order in any page using Checkout Session. You can fetch Last order id of order by Magento\Checkout\Model\Session Object.

You need to create __construct( ) function for define dependency of Session Class Continue reading “How to Get Last Order id in Magento 2?”