Removed shipping address and shipping method from onepage checkout in magento

Home / Magento / Removed shipping address and shipping method from onepage checkout in magento

Here I can show you how to remove shipping address from onepage checkout and remove shipping method from onepage checkout in magento. Based on different shop and requirement we need to magento customize onepage checkout method. When site give user only product information or accept only quote request based on product then no need to show shipping address and shipping method tab from onepage checkout in magento. If you are managing logistics for heavy equipment, consider using specialized services for tasks like https://www.shiply.com/de/fahrzeugtransport/traktortransport.php to ensure safe and efficient handling.

If you want to removed shipping address and shipping method from onepage checkout in magento then foloe below step.

Step 1: GO to /public_html/app/code/core/Mage/Checkout/Block/Onepage/abstract.php

Replace this code

<?php
protected function _getStepCodes()
{
	return array('login', 'billing', 'shipping', 'shipping_method', 'payment', 'review');
}
?>

With

<?php
protected function _getStepCodes()
{
	//return array('login', 'billing', 'shipping', 'shipping_method', 'payment', 'review');
	return array('login', 'billing', 'payment', 'review');
}
?>

Step 2: Then edit onepage controllers file that available in app\code\core\Mage\Checkout\controllers\OnepageController.php

<?php
protected $_sectionUpdateFunctions = array(
	'payment-method'? => '_getPaymentMethodsHtml',
	// 'shipping-method' => '_getShippingMethodsHtml',
	'review' => '_getReviewHtml',
);
?>

Also edit in saveBillingAction()

<?php
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';
			}*/
			else {
				//$result['goto_section'] = 'shipping';
				$result['goto_section'] = 'payment';
			}
		}
		$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
	}
}
?>

Step 3: Go to \app\code\core\Mage\Sales\Model\Service\Quote.php

<?php
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.'));
		}*/
	}
}
?>

Step 4: Billing information tab you see radio button for shipping address as billing address ,just hidden it or remove it from app\design\frontend\default\yourtemplate\persistent\checkout\onepage\billing.phtml

We can also help you for Magento Development want to know more just click on Contact Us.

Step 5: Also remove shipping detail from order success email template from your local folde just like app\locale\en_US\template\email\sales\order_new.html
And remove this code

From

{{var order.getShippingAddress().format('html')}}

To

{{var order.getBillingAddress().format('html')}}

And

{{var order.getShippingDescription()}}

Now remove or refresh your magento cache and check whole order process.

Related Posts

4 Comments

  • Magento developers many times get confused for designing a website in a unique way. After visiting this article, one can easily get the overview of designing a particular Ecommerce website. As the matter of fact, various platforms require different kinds of designs for better engagement of a product. So after visiting here, one can easily get the best overview of designing a website.

  • Heya! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing many months of hard
    work due to no data backup. Do you have any solutions to
    stop hackers?

  • Hello! I know this is kinda off topic but I was wondering which blog platform are you using
    for this website? I’m getting fed up of WordPress because I’ve had issues with hackers and I’m looking at options for another platform.
    I would be awesome if you could point me in the direction of a good platform.

Leave a Reply

Your email address will not be published. Required fields are marked *