LemonStand Documentation

shop:onOrderBeforeCreate event

The shop:onOrderBeforeCreate event allows you to alter the checkout information or cart content before an order is placed. This event is fired only when an order is placed from the front-end website. If you create an order in the Administration Area, the event is not triggered. The event handler should accept a single parameter - the cart name.

Event handler example:

public function subscribeEvents()
{
  Backend::$events->addEvent('shop:onOrderBeforeCreate', $this, 'process_order');
}
 
public function process_order($cart_name)
{
  $price = Shop_Cart::total_price($cart_name);
  if ($price < 100)
    throw new Phpr_ApplicationException('We are sorry, 
      you cannot place orders with total order amount less then 100 USD');
}

Next: shop:onUpdateCartItemPrice event
Previous: shop:onNewOrder event
Return to Handling LemonStand events