Copied to clipboard

Flag this post as spam?

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


  • Vineeth 71 posts 291 karma points
    Sep 16, 2019 @ 07:05
    Vineeth
    0

    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 4123 posts 22194 karma points MVP 9x c-trib
    Sep 16, 2019 @ 07:42
    Matt Brailsford
    100

    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 71 posts 291 karma points
    Sep 16, 2019 @ 08:29
    Vineeth
    0

    Thanks, Matt :)

Please Sign in or register to post replies

Write your reply to:

Draft