19 votes
Accepted

programatically cancel the order using order id - Magento 2

Even though using the OrderFactory would work, save and load methods are deprecated soon, you should use service contracts instead. So you can use Magento/Sales/Api/OrderManagementInterface: First ...
Raphael at Digital Pianism's user avatar
16 votes
Accepted

What's the best event/way to listen for all order state changes in Magento 2?

As far as I know, we can use events: sales_order_save_after and sales_order_state_change_before. I refer sales_order_save_after event. In our observer, we can get the state of order: Observer/...
Khoa TruongDinh's user avatar
12 votes
Accepted

How to get last order status history comment and order status Magento 2

To retrieve latest order's comment history you can do following: $histories = $order->getStatusHistories(); /** @var OrderStatusHistoryInterface $caseCreationComment */ $latestHistoryComment = ...
joni jones's user avatar
  • 2,539
11 votes

Magento 2 New Order Status remains "Processing" instead of "Pending" in custom payment method

In your payment method model you can add protected $_isInitializeNeeded = true; In Magento\Sales\Model\Order\Payment, you will see : public function place() { .... if ($methodInstance-&...
haitao's user avatar
  • 131
10 votes
Accepted

Magento 2: How to get all order status

I got solution code as below: /** * @var Magento\Sales\Model\ResourceModel\Order\Status\CollectionFactory $statusCollectionFactory */ protected $statusCollectionFactory; /** ...
Prashant Valanda's user avatar
9 votes

New order status staying "pending" instead of processing in Magento 2

We can assign the New Order Status. I will give some basic info: Login to Magento Admin > STORES > Configuration > SALES > Payment Methods > Choose the Payment, you will see the config for the New ...
Khoa TruongDinh's user avatar
9 votes
Accepted

Where is "status" located in the database from Magento 2 order grid

Rakesh Donga pointed out the two Queries but more specific queries based on your situation UPDATE sales_order SET state='complete', status='complete' WHERE status = 'processing' UPDATE ...
Muhammad Hasham's user avatar
8 votes

How do you create a new order state for an order status to be assigned to?

you can add state by simply add xml code in your module config.xml <global> <sales> <order> <states> <order_recieved translate="label"> ...
Qaisar Satti's user avatar
  • 32.4k
8 votes
Accepted

Magento 2.3 Change Order Status Programmatically

You can Change status this way.. $orderId = 1; // here order id $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create('\Magento\Sales\...
Rakesh Donga's user avatar
  • 5,324
7 votes
Accepted

How to get Order Status from order id in magento 2?

You need to inject \Magento\Sales\Api\OrderRepositoryInterface class to get order status In Your Block protected $orderRepository; public function __construct( ... \Magento\...
Prince Patel's user avatar
  • 22.6k
6 votes

Magento 2 : Is it possible to add order cancellation functionality in frontend?

This is more complicated than it sounds. Cancellation while pending is easy. The method is described in Cancel Order from magento 2 frontend? and I've implemented it in a module with the template ...
Chris Lingwood's user avatar
6 votes

Magento 2 order flow sequence

first of all, it's worth mentioning that COD (Cash on Delivery) is an off-line payment method in Magento, which means that - upon order placement - no payment in registered in Magento, and the order ...
Dmitri Sologoubenko's user avatar
6 votes

Orders are being canceled automatically in Magento 2?

I had the same problem, and tracked it down to orders that were Pending Payment and they would get cancelled over night. The default setting below is set to 8 hours (I know I wrote 4 hours in the ...
Jason Diehl's user avatar
6 votes

Magento 2.3 Change Order Status Programmatically

You can Change the order status to complete using repository Class of order entity \Magento\Sales\Api\OrderRepositoryInterface $order = $this->orderRepository->get($orderiId); $order-&...
Amit Bera's user avatar
  • 77.2k
5 votes
Accepted

Sales : Orders :How to add custom order status programmatically

First create new status Stores > Order Status and set the code for status custom_cancel and use below code $orderId = 3; $objectManager = \Magento\Framework\App\ObjectManager::...
Qaisar Satti's user avatar
  • 32.4k
4 votes

How to change the default order status of Paypal transactions

Not the answer you want, but the state of orders follow a predefined flow and should not be changed. Only the custom defined status within a state can be changed by your requirements. Aligent ...
Fabian Schmengler's user avatar
4 votes
Accepted

Cannot save shipment

Try this i followed this it's working fine UPDATE eav_entity_store INNER JOIN eav_entity_type ON eav_entity_type.entity_type_id = eav_entity_store.entity_type_id SET eav_entity_store....
Magento 2's user avatar
  • 3,834
4 votes
Accepted

Magento Ordered Item Status is MIXED

I reckon it's because you have not invoiced yet. Basically, the code that handles those item status looks like this: if (!$invoiced && !$shipped && !$refunded && !$canceled &...
Raphael at Digital Pianism's user avatar
4 votes
Accepted

Programmatically get pending payment orders and canceled orders?

You can use the below code : $orders = Mage::getModel('sales/order')->getCollection() ->addFieldToFilter('status', array('in' => array('complete','processing','pending_payment','...
Manashvi Birla's user avatar
4 votes
Accepted

Creating new order states programmatically in Magento2

We should take a look some tests: dev/tests/integration/testsuite/Magento/Payment/_files/order_status.php /** @var \Magento\Sales\Model\Order\Status $status */ $status = \Magento\TestFramework\...
Khoa TruongDinh's user avatar
4 votes
Accepted

Magento2 Mass Action to Sales Order Grid

Create a module with name Vendor_Module by following steps: Step 1: Create registration.php under: app/code/Vendor/Module/registration.php with below content: <?php \Magento\Framework\...
Sukumar Gorai's user avatar
4 votes
Accepted

Magento 2 order status not changing?

There are few possibilities that order status is not changing. 1.You have made some modifications in Auctane Shipstation Shipment Model file app/code/community/Auctane/Api/Model/Action/Shipnotify.php....
Rajneesh Gupta's user avatar
4 votes

Where is "status" located in the database from Magento 2 order grid

The first query will update the state and status on the table sales_order. mysql> UPDATE sales_order SET state='complete', status='complete' WHERE increment_id IN (000043719,000044003,000044117,......
Rakesh Donga's user avatar
  • 5,324
4 votes

how to change Sales order default status? Magento 2

For this You need to create new status and assign it to State go to admin panel Stores > Settings > Order Status create YOUR NEW STATUS after that go to "Assign Status to State", here select YOUR NEW ...
Shorabh's user avatar
  • 1,510
3 votes
Accepted

Adding some custom order status in Magento

For achieve thing you need to understand magento Default order Flow: Please check the below image for understand magento order flow As per as my thought,You need to do coding for achieve this thing ...
Amit Bera's user avatar
  • 77.2k
3 votes
Accepted

How to get sms automatically after place an order?

Easy: Get a service that can do SMS (really, you need a service, magento cannot do this by itself) Confirm they have an API that you can communicate with to initiate the sending. (this is of course a ...
ProxiBlue's user avatar
  • 9,926
3 votes
Accepted

Get Payment Update button not connecting to Authorize.net

I finally found a solution after struggling for a good long time. Solution (At least for me) Login to your merchant account on authorize.net Click 'Account' Tab along top Under 'Security Settings' ...
dmartin's user avatar
  • 46
3 votes
Accepted

CE 1.9.2 - Store custom data temporarily in the order object during checkout

You have several options to do this, each with their own advantages and disadvantages. I always start looking whether the available session objects can be used. You'll find a great write-up of what ...
Peter Jaap Blaakmeer's user avatar
3 votes

how to manually set order status to "Complete"?

The following SQL queries should set an orders status UPDATE sales_flat_order_grid SET status = 'complete'; UPDATE sales_flat_order SET state = 'complete', status = 'complete'; Of course, if you ...
Arunendra's user avatar
  • 7,386
3 votes

order status and state - magento 2

Go Stores > Order Status and Click on Assign status to state button above show in screenshot and you'll be able to change that. Important note for Pending Payments If you have a "pending ...
Baharuni Asif's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible