Question

The default backend Magento 1.8.1 FedEx setting do not allow for the option of removing insurance and forces the default value of the item to be fully insured.

    'Version' => $this->getVersionInfo(),
        'RequestedShipment' => array(
            'DropoffType'   => $r->getDropoffType(),
            'ShipTimestamp' => date('c'),
            'PackagingType' => $r->getPackaging(),
            'TotalInsuredValue' => array(
                'Amount'  => $r->getValue(),
                'Currency' => $this->getCurrencyCode()

I am trying to get the 'Amount' to be set at $99 (all shipments get a default $100 coverage if damaged). Should I add the following line:

'Amount' => 99,

Please advise :)

Was it helpful?

Solution

I'm trying to remove the insurance value so my solution should be suitable as well for you.

As pointed out by @Chris you should rewrite this file app/code/core/Mage/USA/Model/Shipping/Carrier/Fedex.php

and change the method _formRateRequest

How to Remove the insurance
comment the code as shown below:

( line 330 )

 'RequestedShipment' => array(
                'DropoffType'   => $r->getDropoffType(),
                'ShipTimestamp' => date('c'),
                'PackagingType' => $r->getPackaging(),
//                'TotalInsuredValue' => array(
//                    'Amount'  => $r->getValue(),
//                    'Currency' => $this->getCurrencyCode()
//                ),
                'Shipper' => array(
                    'Address' => array(
                        'PostalCode'  => $r->getOrigPostal(),
                        'CountryCode' => $r->getOrigCountry()
                    )
                ),

AND ( line 380 )

       if ($purpose == self::RATE_REQUEST_GENERAL) {
//            $ratesRequest['RequestedShipment']['RequestedPackageLineItems'][0]['InsuredValue'] = array(
//                'Amount'  => $r->getValue(),
//                'Currency' => $this->getCurrencyCode()
//            );
        } 

Change the amount
if you want to use a fix value instead of commenting the line you should just set the 'Amount' to a fix value

Suppose you want a fixed amount of 100$

Change the code as shown below:

Add this variable on the top of the method

$amount = 100;

( line 330 )

 'RequestedShipment' => array(
                'DropoffType'   => $r->getDropoffType(),
                'ShipTimestamp' => date('c'),
                'PackagingType' => $r->getPackaging(),
                'TotalInsuredValue' => array(
                'Amount'  => $amount),
                'Currency' => $this->getCurrencyCode()
                ),
                'Shipper' => array(
                    'Address' => array(
                        'PostalCode'  => $r->getOrigPostal(),
                        'CountryCode' => $r->getOrigCountry()
                    )
                ),

AND ( line 380 )

       if ($purpose == self::RATE_REQUEST_GENERAL) {
           $ratesRequest['RequestedShipment']['RequestedPackageLineItems'][0]['InsuredValue'] = array(
               'Amount'  => $amount,
               'Currency' => $this->getCurrencyCode()
            );
        } 

OTHER TIPS

Setting Amount to 99 will work as intended.

Following @WonderLand instructions worked like a charm! Took me a week initially to figure out how to remove the declared value from the rate calculation. I simply edited the file app/code/core/Mage/USA/Model/Shipping/Carrier/Fedex.php, did a search in dreamweaver for $r->getValue() and replaced all instances with 100.

SIDE NOTE: For whatever it's worth all of my caches under magento configuration were already disabled. Not sure if it matters, but it didn't require me to clear/empty any caches to see the changes immediately on the frontend.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top