I am trying to associate orders and customer using the following code.
$order = $this->orderRepo->get($oid); $order->setCustomerId($newCustomer->getId()); $order->setCustomerIsGuest(0); $this->orderRepo->save($order);
Where orderRepo is
But save is not working as expected and I can’t see association in order details page/customer order section.
I have checked in the
create method in
\Magento\Sales\Model\Order\CustomerManagement and Magento is doing the same.