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?”

Add extension attribute in order data magento 2.

Magento 2 comes with a new design pattern called the service contracts. A service contract is a set of PHP interfaces used in a module. You can check an interface in any module API folder. Service contract includes service and data interfaces, which hide business logic details.

In Magento 2 You can add extension attributes for Order by creating an extension_attributes.xml file. Extension attributes are the persistent Attribute so you can’t find extension_attributes values in a database.

Continue reading “Add extension attribute in order data magento 2.”