Is there a way to update payment method of order in magento 2 via dependency Injector or Object factory without using raw sql query?


You need to load order instance either from order entity_id or increment_id. After that, try these code. I haven't tested these code

$payment = $order->getPayment();


$order->getPayment()->importData(['method' => 'yourpaymentmethodcode']);

I hope this will help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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