Let see how to remove shipping address and method from onepage checkout in magento
Go to:
app\code\core\Mage\Checkout\Block \Onepage.php
Change the code :
public function getSteps()
{
$steps = array();
if (!$this->isCustomerLoggedIn()) {
$steps['login'] = $this->getCheckout()->getStepData('login');
}
//$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
$stepCodes = array('billing', 'payment', 'review');
foreach ($stepCodes as $step) {
$steps[$step] = $this->getCheckout()->getStepData($step);
}
return $steps;
}
Go to:
app\code\core\Mage\Checkout\controllers\ OnepageController.php
Edit:
protected $_sectionUpdateFunctions = array( 'payment-method' => '_getPaymentMethodsHtml', // 'shipping-method' => '_getShippingMethodsHtml', 'review' => '_getReviewHtml', );
Also edit saveBillingAction() function
public function saveBillingAction() { if ($this->_expireAjax()) { return; } if ($this->getRequest()->isPost()) { //$postData = $this->getRequest()->getPost('billing', array()); //$data = $this->_filterPostData($postData); $data = $this->getRequest()->getPost('billing', array()); $customerAddressId = $this->getRequest()->getPost('billing_address_id', false); if (isset($data['email'])) { $data['email'] = trim($data['email']); } $result = $this->getOnepage()->saveBilling($data, $customerAddressId); if (!isset($result['error'])) { /* check quote for virtual */ if ($this->getOnepage()->getQuote()->isVirtual()) { $result['goto_section'] = 'payment'; $result['update_section'] = array( 'name' => 'payment-method', 'html' => $this->_getPaymentMethodsHtml() ); } /*elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) { $result['goto_section'] = 'shipping_method'; $result['update_section'] = array( 'name' => 'shipping-method', 'html' => $this->_getShippingMethodsHtml() ); $result['allow_sections'] = array('shipping'); $result['duplicateBillingInfo'] = 'true'; }*/ //End of Comment by Amit Bera else { //$result['goto_section'] = 'shipping'; $result['goto_section'] = 'payment'; } } $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result)); } }
Go to:
\app\code\core\Mage\Sales\Model\Service\ Quote.php
Edit:
protected function _validate() { $helper = Mage::helper('sales'); if (!$this->getQuote()->isVirtual()) { $address = $this->getQuote()->getShippingAddress(); $addressValidation = $address->validate(); // if ($addressValidation !== true) { // Mage::throwException( //$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation)) //); //} // $method= $address->getShippingMethod(); //$rate = $address->getShippingRateByCode($method); //if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) { //Mage::throwException($helper->__('Please specify a shipping method.')); //} }
In billing information tab you see radio button for shipping address as billing address ,just hidden it or remove it .the file located at – app\design\frontend\default\your template\yourtemplate\persistent\checkout\onepage\billing,phtml
Or
app\design\frontend\default\your template\template \checkout\onepage\billing,phtml
In app\locale\en_US\template\email\sales\ order_new.html
From
{{var order.getShippingAddress().format('html')}}
To
{{var order.getBillingAddress().format('html')}}
And
{{var order.getShippingDescription()}}
Remove it.