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

Call method to get last order id using below way,

$orderId = $this->checkoutSession->getData(‘last_order_id’);

$orderId is your recent order id for a store.