Tuesday, May 13, 2014

International Shipping


Here is how I created different shipping rates for international shipping. 

Create a custom shipping module using Inchoo Custome shipping and change the shipping rate based on cart's total weight.

$quote = Mage::getSingleton('checkout/session')->getQuote();
$shippingCountryId = $quote-> getShippingAddress () -> getCountryId ();
$weight = 0;
$cartItems = $quote->getAllVisibleItems();
foreach ($cartItems as $item) {
$weight += ($item->getWeight() * $item->getQty()) ;
        }
        if ($shippingCountryId != 'IN'){
$freeBoxes+= $weight * xxx; // xxx = international shipping rate per kg.
}

        $this->setFreeBoxes($freeBoxes);
     

No comments:

Post a Comment