LemonStand Documentation

shop:onOrderBeforeUpdate event

The shop:onOrderBeforeUpdate event is triggered before an order record is updated in the database. It can happen when a user saves an order in the Administration Area. The event handler should accept two parameters - the order object (Shop_Order) and the form session key. You can use the session key for loading a list of the order items.

Event handler example:

public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onOrderBeforeUpdate', $this, 'process_order_update');
}
 
public function process_order_update($order, $session_key)
{
  // Perform some check
  if ($order->total > 10000)
    throw new Phpr_ApplicationException('Order total should not exceed $10,000');
  
  $items = $order->list_related_records_deferred('items', $session_key);
}

Next: shop:onOrderStockChange event
Previous: shop:onAutomatedBillingSupported event
Return to Handling LemonStand events