In this blog, we will see how to remove the shipping method step from magento onepage checkout
The source code of this module has been tested in magento 1.6 version but should work fine 1.4+.
Removing the shipping method step is pretty simple, here are the steps
to do it. I am going to set the ‘freeshipping’ shipping method as the
default shipping method so that the checkout process goes smoothly. Also
for this code to work make sure the freeshipping method is enabled from
admin. Attached is the source code for this module
open app\code\core\Mage\Checkout\Block\Onepage.php
change
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
$stepCodes = array('billing', 'shipping', 'payment', 'review');
also open app\code\core\Mage\Checkout\controllers\OnepageController.php
find function saveBillingAction()
add
if (!isset($result['error'])) {
$method = 'freeshipping_freeshipping';
$result = $this->getOnepage()->saveShippingMethod($method);
Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()-> setShippingMethod($method)->save();
before
if (!isset($result['error'])) {
if ($this->getOnepage()->getQuote()->isVirtual()) {
also change
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()
);
into
elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
find function saveShippingAction()
look on
if (!isset($result['error'])) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
change
if (!isset($result['error'])) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
And also go to the app\code\core\Mage\Checkout\Model\Type\Onepage.php
add if(empty($shippingMethod))
$shippingMethod = 'freeshipping_freeshipping';
after starting of public function saveShippingMethod($shippingMethod) {