I want to apply 15% discount on shipping rate that magento get from ups api.is it possible to do?


1 Answer 1


Take a look at this post: http://www.magentocommerce.com/boards/viewthread/316685/. It is based on observer, but if you rewrite particular class it should work ok also. Note that inside this loop you should check that you are applying the discount only to the UPS rates

$rates = $address->collectShippingRates()

foreach ($rates as $carrier) {
//Check that the carrier is UPS
if ($carrier->getCarrierCode() == 'ups') {
    foreach ($carrier as $rate) {
        //calculate 15% discount


  • Can you tell me which file to modify?Its urgent
    – Vishal
    Commented Feb 15, 2014 at 21:17
  • As mentioned you should create an event observer: meteorify.com/2012/12/making-use-of-observers-in-magento. Than in you config.xml subscribe for the <sales_quote_address_collect_totals_after>. Do not modify the core files(you will loose you changes on upgrade). Just create an event observer and follow the article magentocommerce.com/boards/viewthread/316685. Commented Feb 16, 2014 at 5:39
  • I have override ups.php file in local folder. Is it ok?
    – Vishal
    Commented Feb 20, 2014 at 18:30
  • I think it is better to use an observer as mentioned in the article. It will save you some headaches in the future. Try to use an observer. Commented Feb 20, 2014 at 20:19
  • so for 15% discount ,$ rate-> setPrice ($ price*0.85) right?
    – Vishal
    Commented Feb 20, 2014 at 22:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.