Ow
$formatPrice = Mage::helper('core')->currency($shippingrate, false, false);
$quote = $this->_getQuote();
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
$customerData->getId();
}
$customer = Mage::getModel('customer/customer')->load($customerData->getId());
$customerShippingAddress = $customer->getDefaultShippingAddress();
$country = $customerShippingAddress->getData('country_id');
$postcode = $customerShippingAddress->getData('postcode');
$city = $customerShippingAddress->getData('city');
$regionId = $customerShippingAddress->getData('region_id');
$region = $customerShippingAddress->getData('region');
$this->_getQuote()->getShippingAddress()
->setCountryId($country)
->setCity($city)
->setPostcode($postcode)
->setRegionId($regionId)
->setRegion($region)
->setCollectShippingRates(true);
$this->_getQuote()->save();
$this->_getSession()->setEstimatedShippingAddressData(array(
'country_id' => $country,
'postcode' => $postcode,
'city' => $city,
'region_id' => $regionId,
'region' => $region
));
$this->_getQuote()->getShippingAddress()->setCollectShippingRates(true);
$this->_getQuote()->setShippingAmount($formatPrice)->setBaseShippingAmount($formatPrice)->collectTotals()->save();
Grand total not updated , any idea ?
Try this link.
https://magento.stackexchange.com/questions/30686/add-shipping-in-cart
I have tried, it is working..
remember to replace your default shipping method needs to replace in
BTS_Checkout_Model_Observer
Currently, they have selected 'royalmail'.
private $_shippingCode = 'royalmail';
Hope this link will help you.
I already tried above but not properly work, i want to add shipping amount into cart total from controller file
We need to $50 shipping rate add in cart subtotal when checkbox not checked within 2 seconds from cart controller.