0

I am using the sales_order_shipment_save_after event and in that i want to set the order status to processing because magento set the status to complete once the shipment is submited but I want to keep the status processing after shipment also.

2 Answers 2

1

in your observer try the following code..and add necessary condition based on your requirement

  <?php
namespace Vendor\OrderStatus\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;

class KeepOrderStatusProcessing implements ObserverInterface
{
    public function execute(Observer $observer)
    {
     
        $shipment = $observer->getEvent()->getShipment();

       
        $order = $shipment->getOrder();

       
        $order->setStatus('processing');

       
        $order->save();
    }
}
0

I believe you are using an online payment method and upon an order being placed on the website, the order status is already in the Processing status. That is why when you submit the shipment, the order status adjusts to Complete.

However, you can use Event Observer to set the Order status as processing on shipment submission. You can put a condition that your logic should be applied the first time (when the shipment is created. Not updated.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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