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) {
Hi, thx for help with removing this method from checkout it's really annoying and beside this solution I haven't found any other working but... If You take a closer look this method of removing works till You select shipping address different from the one in billing section. I try to solve this by myslef but ntohing seems to work. Could You tweak this solution a little bit so this error with different shipping address would be also removed ;) Thx in advance. Oooh by the way I'm running on Magento v1.6.2.0
ReplyDeleteI think I've found a solution. There is an error in the code You provided:
ReplyDelete"in 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',"
I've noticed that there is a missing line:
in core file: 'html' => $this->_getShippingMethodsHtml()
should be changed to:
'html' => $this->_getPaymentMethodsHtml()
So the whole last fragment of code should look like this:
if (!isset($result['error'])) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
}
After that everything is running smoothly like it should :)
Hope this helps, cheers!
Awesome, thanks Jarek
DeleteThis comment has been removed by the author.
ReplyDeleteHI,
ReplyDeleteHow to remove review tab. My client wants only three steps.
Checkout menthod-->Billing -->and Payment.
So my last tab is payment.
I want Place order button in my payment tab, how i do this. PLease help me,,,,,
Hi can you include how to remove the shipping information also?
ReplyDeleteNice code ! works perfectly with 1.7
ReplyDeleteThanks :)
My brother recommended I may like this website. He used to be entirely right. This submit truly made my day. You can not believe simply how so much time I had spent for this info! Thanks!
ReplyDeleteHire Magento Developers
Great Read! I am impressed on how you make your article easy to understand. I'll come back for more :D
ReplyDeleteoffshore magento development