Search by orderNumber


I am trying to use the orderNumber instead of the orderId to search for orders.

I tried something like

$criteria->addFilter(new EqualsFilter('orderNumber', 10010));
$transactions = $this->orderRepository->search($criteria, $context);

but it does not work as expected: “Field “orderNumber” in entity “order_transaction” was not found.”

Could someone please advise?

I think you are using the wrong repository - namely order_transaction instead of order. You have probably messed up the order of service injections (including the repositories) in your services.xml file and in your class constructor.