3

How get specific row from sales_order_item by giving item_id?
Which collection use to filter row?
Can anyone guide me ? has any direct or indirect way to fetch sales_order_item record from item_id?

1 Answer 1

1

Try using the repository.

use Magento\Sales\Api\OrderItemRepositoryInterface;

/**
 * @var OrderItemRepositoryInterface
 */
private $orderItemRepository;


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

Now:

$orderItem = $this->orderItemRepository->get(4);
error_log($orderItem->getName());
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.