How to remove specific item from cart Magento 2?

You can delete specific quote items from the cart by quote id and item id in Magento 2.

With the help of Cart Item Interface, Magento\Quote\Api\CartItemRepositoryInterface you can use the deleteById() method.

Prerequisite to delete quote item:

          • Quote ID
          • Quote Item ID

<?php
declare(strict_types=1);

namespace Rbj\QuoteItem\Model;

use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Quote\Api\CartItemRepositoryInterface;
use Magento\Checkout\Model\Session as CheckoutSession;

class CheckoutQuote
{
    public function __construct(
        private CheckoutSession $checkoutSession,
        private CartItemRepositoryInterface $cartItemRepository
    ) {
    }

    /**
     * Remove specific items from cart
     *
     * @return void
     * @throws NoSuchEntityException
     * @throws CouldNotSaveException
     */
    public function removeQuoteItem(): void
    {
        try {
            $quoteId = $this->checkoutSession->getQuoteId();
            $itemId = 10; // QUOTE ITEM ID
            $this->cartItemRepository->deleteById($quoteId, $itemId);
        } catch (NoSuchEntityException $e) {
            throw new NoSuchEntityException(__('The cart doesn\'t contain the item.'));
        }
    }
}

Using this method, you can remove the specific quote item id from the existing quote.