Magento 1 Event: After Calculate Recurring Shipping Rate


Event Code: subscribepro_autoship_after_calc_recurring_shipping_rate

Overview

The subscribepro_autoship_after_calc_recurring_shipping_rate event is dispatched just after the Subscribe Pro extension calculates the recurring shipping cost based on the settings on the Subscribe Pro Shipping method. This event is only relevant when the Subscribe Pro Shipping method is used for recurring orders.

Parameters

NameDescription
'request'An instance of the Mage_Shipping_Model_Rate_Request class.
'quote'An instance of the Mage_Sales_Model_Quote class.
'rate'An instance of the Mage_Shipping_Model_Rate_Result_Method class.

Eample

Example

config.xml

<config>
    <global>
        <events>
            <subscribepro_autoship_after_calc_recurring_shipping_rate>
                <observers>
                    <my_module_subscribepro_autoship_after_calc_recurring_shipping_rate>
                        <class>my_module/observer</class>
                        <method>onAfterCalcRecurringShippingRate</method>
                    </my_module_subscribepro_autoship_after_calc_recurring_shipping_rate>
                </observers>
            </subscribepro_autoship_after_calc_recurring_shipping_rate>
        </events>
    </global>
</config>

Observer.php

public function onAfterCalcRecurringShippingRate(Varien_Event_Observer $observer)
{
    // Get data from $observer
    /** @var Mage_Sales_Model_Quote_Item $quoteItem */
    $rate = $observer->getData('rate');

    $newPrice = 10;
    $rate->setPrice($newPrice);
}