I have created order with status pending and state new when i am creating invoice with not capture than status is processing and same for creating ship. i want to change order status after shipping to shipped.

1 Answer 1


i Got answer

create observer on sales_order_shipment_save_after event

    <?xml version="1.0"?>
     * Copyright © 2016 Magento. All rights reserved.
     * See COPYING.txt for license details.
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">

        <event name="sales_order_shipment_save_after">
            <observer name="tenx_sales_order_shipment_save_after" instance="Tenx\SalesExt\Observer\SalesOrderShipmentSaveAfter" />

create observer.

 public function execute(\Magento\Framework\Event\Observer $observer) {

        $shipment = $observer->getEvent()->getShipment();
        /** @var \Magento\Sales\Model\Order $order */
        $order = $shipment->getOrder();
        /*$order->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT, true);
        $order->addStatusToHistory($order->getStatus(), 'Order processed successfully with reference');

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.