How to Get order increment id using order id in Magento 2
You have to pass \Magento\Sales\Api\OrderRepositoryInterface
in construct of your class.
protected $orderRepository;
public function __construct(
...,
\Magento\Sales\Api\OrderRepositoryInterface $orderRepository
){
...
$this->orderRepository = $orderRepository;
}
Then you can do following:
$order = $this->orderRepository->get($orderId);
$orderIncrementId = $order->getIncrementId();