Allows to update shipping parameters before they are sent to a shipping method.
The event handler should accept 2 parameters - the
Shop_ShippingOption object and an array of shipping parameters.
The handler should return updated shipping params as an associative array. The
$params array
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.
Event handler example:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onBeforeShippingQuote', $this, 'before_shipping_quote');
}
public function before_shipping_quote($shipping_option, $params)
{
return array(
'zip' => '55155',
'city' => 'Hollywood'
);
}