How to Delete Order item by id Magento 2?

Magento 2, Sales Order item has information of Order items like Item Id, Parent order id, SKU, name, and much more information.

If you want to delete an Order item by item id using Magento 2, You can delete it safely using OrderItemRepositoryInterface.

Just instantiate the Order Item Interface to your Class Constructor method and you can use the deleteById() method from the interface to delete specific item IDs.

<?php
namespace Jesadiya\DeleteOrderItem\Model;

use Exception;
use Psr\Log\LoggerInterface;
use Magento\Sales\Api\OrderItemRepositoryInterface;

class DeleteOrderItem
{
    /**
     * @var OrderItemRepositoryInterface
     */
    private $orderItemRepository;

    public function __construct(
        OrderItemRepositoryInterface $orderItemRepository
    ) {
        $this->orderItemRepository = $orderItemRepository;
    }

    /**
     * result
     *
     * @return bool
     */
    public function deleteOrderItem()
    {
        $itemId = 1; //DYNAMIC_ID
        try{
            $this->orderItemRepository->deleteById($itemId);
        } catch (Exception $exception) {
            $this->logger->error($exception->getMessage());
        }
    }
}

You need to pass the Dynamic value of the Item Id to delete from the sales_order_item table.

Using the code snippets, You can delete the order item id from the database table.

Output:
Boolean