shop:onUpdateShippingQuote event
The shop:onUpdateShippingQuote event allows to update a shipping quote calculated by a regular shipping method. The event handler should accept 2 parameters - the Shop_ShippingOption object and an array of shipping parameters. The event handler should return updated shipping quote. The parameters array (the second event handler parameter) contains the following elements:
- quote - the original shipping quote
- option_id - for multi-option shipping methods only (like USPS) - service-specific identifier of the shipping option
- option_name - for multi-option shipping methods only (like USPS) - service-specific name of the shipping option
- shipping_option - the Shop_ShippingOption object which returned the original quote
- handling_fee - the handling fee, defined in the shipping method
- country_id - shipping country identifier
- state_id - shipping state identifier
- zip - shipping ZIP/Postal code
- city - shipping city
- total_price - total price of all order items
- total_volume - total volume of all order items
- total_weight - total weight of all order items
- total_item_num - total number of order items
- cart_items - a list of shopping cart items (an array of Shop_CartItem or Shop_OrderItem objects, depending on the caller context). When processing existing orders, LemonStand can automatically convert order items to cart items. In this case the reference to the original order item is stored in the $order_item field of the cart item object.
Event handler example:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onUpdateShippingQuote', $this, 'update_shipping_quote');
}
public function update_shipping_quote($shipping_option, $params)
{
return $params['quote']*2;
}Next: core:onSendEmail event
Previous: shop:onOrderError event
Return to Handling LemonStand events

