Question

I installed Magento 1.8 CE and want to to hide the shipping steps from the checkout, all shipping is free as we will never use the physical address to send anything, everything will be sent to the customer by email.

I have checked a lot of posts for the versions before 1.8, and nothing for 1.8ce

Any help with this? is there any configuration through the admin?

Was it helpful?

Solution 2

please use products type as a downloadable products instead of simple products or grouped type or using other.downloadable product by default hide the shipping method and shipping details.

OTHER TIPS

To hide shipping method step on checkout page, you can temporary comment the default Magento functions being used and use the modifed one's as posted below. If the solution is feasible for you then just comment out the code and paste the changes in specific functions.

Go to app/code/core/Mage/Checkout/Model/Type/Onepage.php

public function saveShippingMethod($shippingMethod)
    {


        if (empty($shippingMethod)) {
            $shippingMethod = 'freeshipping_freeshipping';
            //return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid shipping method.'));
        }
        /*$rate = $this->getQuote()->getShippingAddress()->getShippingRateByCode($shippingMethod);
        if (!$rate) {
            return array('error' => -1, 'message' => Mage::helper('checkout')->__('Invalid shipping method.'));
        }*/
        $this->getQuote()->getShippingAddress()
            ->setShippingMethod($shippingMethod);

        $this->getCheckout()
            ->setStepData('shipping_method', 'complete', true)
            ->setStepData('payment', 'allow', true);

        return array();
    }

Go to app/code/core/Mage/Checkout/controllers/OnepageController.php

public function saveBillingAction()
    {
        if ($this->_expireAjax()) {
            return;
        }
        if ($this->getRequest()->isPost()) {
            $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'])) {

                $method = 'freeshipping_freeshipping';
                $result = $this->getOnepage()->saveShippingMethod($method);
                Mage::getSingleton('checkout/type_onepage')->getQuote()->getShippingAddress()-> setShippingMethod($method)->save();
            }

            if (!isset($result['error'])) {
                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';
                }*/

                }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()
                        );
                }else {
                    $result['goto_section'] = 'shipping';
                }
            }

            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }


     public function saveShippingAction()
    {
        if ($this->_expireAjax()) {
            return;
        }
        if ($this->getRequest()->isPost()) {
            $data = $this->getRequest()->getPost('shipping', array());
            $customerAddressId = $this->getRequest()->getPost('shipping_address_id', false);
            $result = $this->getOnepage()->saveShipping($data, $customerAddressId);

            /*if (!isset($result['error'])) {
                $result['goto_section'] = 'shipping_method';
                $result['update_section'] = array(
                    'name' => 'shipping-method',
                    'html' => $this->_getShippingMethodsHtml()
                );
            }*/

            if (!isset($result['error'])) {
                $result['goto_section'] = 'payment';
                $result['update_section'] = array(
                    'name' => 'payment-method',
                    'html' => $this->_getPaymentMethodsHtml()
                );
            }

            $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
        }
    }

Go to app\code\core\Mage\Checkout\Block\Onepage.php

public function getSteps()
    {
        $steps = array();
        $stepCodes = $this->_getStepCodes();

        unset($stepCodes[2]);
        unset($stepCodes[3]);

        if ($this->isCustomerLoggedIn()) {
            $stepCodes = array_diff($stepCodes, array('login'));
        }

        foreach ($stepCodes as $step) {
            $steps[$step] = $this->getCheckout()->getStepData($step);
        }

        return $steps;
    }

Go to app\design\frontend\default\default\template\checkout\onepage\progress.phtml comment below code

<?php echo $this->getChildHtml('shipping.progress') ?>
<?php echo $this->getChildHtml('shippingmethod.progress') ?>

Go to app/code/core/Mage/Sales/Model/Service/Quote.php

protected function _validate()
    {
        if (!$this->getQuote()->isVirtual()) {
            $address = $this->getQuote()->getShippingAddress();
            $addressValidation = $address->validate();
            if ($addressValidation !== true) {
                Mage::throwException(
                    Mage::helper('sales')->__('Please check shipping address information. %s', implode(' ', $addressValidation))
                );
            }
            /*$method= $address->getShippingMethod();
            $rate  = $address->getShippingRateByCode($method);
            if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
                Mage::throwException(Mage::helper('sales')->__('Please specify a shipping method.'));
            }*/
        }

        $addressValidation = $this->getQuote()->getBillingAddress()->validate();
        if ($addressValidation !== true) {
            Mage::throwException(
                Mage::helper('sales')->__('Please check billing address information. %s', implode(' ', $addressValidation))
            );
        }

        if (!($this->getQuote()->getPayment()->getMethod())) {
            Mage::throwException(Mage::helper('sales')->__('Please select a valid payment method.'));
        }

        return $this;
    }

Once the aove changes are done, please test the complete order process in order to see the changes done to eliminate shipping step.

Set: Product Type as: Virtual Product. This will turn-off #3 Shipping Information & #4 Shipping Method.

Checkout Process will become:

  1. List item
  2. Checkout Method
  3. Billing Information
  4. Payment Information
  5. Order Review

Works on Version 1.8 - 1.9 CE

Read Magento Knowledge Base: Understanding Product Types: http://www.magentocommerce.com/knowledge-base/categories/category/product-types

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top