Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Vineeth 67 posts 277 karma points
    Sep 16, 2019 @ 07:05

    Change order status before or after order finalized

    How can we change the order status in the tea commerce backend when an order is finalized or before finalized? I need to change the status by code when an order is completed.

  • Matt Brailsford 2409 posts 11700 karma points MVP 6x c-trib
    Sep 16, 2019 @ 07:42
    Matt Brailsford

    Hi Vineeth,

    Probably your best bet is to hook into the Finalizing event to be notified when an order is just about to be finalized. The sender argument for the event is the order in question, so within the handler, you should be able to set the orders OrderStatusId from there.

    If you do set it within the finalizing event, this is before the order is saved so you shouldn't need to call .Save() yourself, however as the finalizing event is the last event to run, setting the order status ID from within the finalizing event, won't fire the OrderStatusChanging event should that be something you are relying on. The OrderStatusChanged should still fire though, post persistence, so it may be you can use that instead if you are using it.

  • Vineeth 67 posts 277 karma points
    Sep 16, 2019 @ 08:29

    Thanks, Matt :)

Please Sign in or register to post replies

Write your reply to: