cancel
Showing results for 
Search instead for 
Did you mean: 

update order fields magento 2

SOLVED

update order fields magento 2

I have a use case where I need to update the order status (e.g. set to 'completed). In magento one I just called setStatus and then save

 

 

$order>setState('your_state')
$order->setStatus($status);
$order->save();

But for magento 2 I get "function setStatus not found"

 

How do I update order fields such as status and other fields in Magento 2?

 

Thanks

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: update order fields magento 2

This is just your inaccuracy.

The \Magento\Sales\Model\Order has the setStatus method: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Sales/Model/Order.php#L3306-L3309

View solution in original post

3 REPLIES 3

Re: update order fields magento 2

This is just your inaccuracy.

The \Magento\Sales\Model\Order has the setStatus method: https://github.com/magento/magento2/blob/2.0.0/app/code/Magento/Sales/Model/Order.php#L3306-L3309

Re: update order fields magento 2

my bad...not calling setState correctly (forgot hyphen "-") using $order>setState(), should be $order->setState()

Re: update order fields magento 2

Thanks @Dmitry_Fedyuk