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 ...
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/...
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 = ...
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-&...
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;
/**
...
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 ...
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 ...
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">
...
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\...
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\...
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 ...
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 ...
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 ...
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-&...
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::...
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 ...
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....
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 &...
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','...
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\...
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\...
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....
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,......
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 ...
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 ...
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 ...
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' ...
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
order-status × 422magento2 × 141
orders × 124
magento-1.9 × 91
sales-order × 63
magento-2.1 × 23
order-state × 21
event-observer × 20
paypal × 20
status × 20
invoice × 19
magento2.3 × 17
payment × 15
payment-methods × 14
magento-1.7 × 13
admin × 12
checkout × 11
email × 11
rest-api × 11
order-grid × 11
order-email × 10
api × 9
shipping × 9
magento-1.8 × 8
module × 7