Magento Onestep Checkout – Remove Payment Method Step

In this blog post, we will see how to remove the payment method step from onepage checkout.

This source code of this blog has been tested in magento 1.6 but should work on magento 1.4+, no core magento files have been changed including javascript files.
Removing the payment method step is very complex and require many files changes, so this blog would be lengthy again [:)]. Attached is source code for the module
As explained in the previous blog post, the basic idea of removing any step from checkout is to see a set a default value for that step, so that magento order processing runs smoothly. So when removing the payment method step, i have set the payment method “Zero Subtotal Checkout” with code “free” as the default payment method.

Magneto Zero Subtotal Payment Method

Magneto Zero Subtotal Payment Method

Now lets see step by step how to do it.

Step1: Onepage Block

First we need to override the Onepage.php block, so that we can change the steps array. So to override the block Mage_Checkout_Block_Onepage open your module’s config.xml file and put inside the blocks tag, below code


So the core block Mage_Checkout_Block_Onepage has been overridden by Excellence_Remove_Block_Onepage block. In the code in this block is

class Excellence_Remove_Block_Onepage extends Mage_Checkout_Block_Onepage
	public function getSteps()
		$steps = array();

		if (!$this->isCustomerLoggedIn()) {
			$steps['login'] = $this->getCheckout()->getStepData('login');

		$stepCodes = array('billing', 'shipping', 'shipping_method', 'review');

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

So here as we can see i have removed the ‘payment’ step from the $stepCodes array.

Step2: PHTML and Layout Files

Next we need to make changes to these phtml files
1. checkout/onepage.phtml : To include our new javascript files
2. checkout/onepage/shipping_method.phtml: To change the shipping method javascript, so that after shipping step, review step shows up instead of payment step
3. checkout/onepage/progress.phtml: To remove payment method from progress sidebar
4. checkout/onepage/review/info.phtml: To make changes in submit order javascript
I am just pointing out changes done in these phtml files, for details you can download and see the module. Also there files have been overridden through layout xml inside the remove/ folder, so no changes made to core files. So in the file remove/checkout/onepage.phtml a new javascript file has been added for our custom javascript needs

<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/removecheckout.js') ?>"></script>


var checkout = new Excellence(accordion,{

instead of

var checkout = new Checkout(accordion,{

In the file remove/checkout/onepage/shipping_method.phtml the change is

var shippingMethod = new ExcellenceShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>");

instead of

var shippingMethod = new ShippingMethod('co-shipping-method-form', "<?php echo $this->getUrl('checkout/onepage/saveShippingMethod') ?>");

In the file remove/checkout/onepage/progress.phtml
I have simple removed the Payment Method box.
In the file remove/checkout/onepage/review/info.phtml change made is

review = new ExcellenceReview('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));

instead of

review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));

So as we can see in the above changes, the major changes made are using of 3 new javascript classes Excellence,ExcellenceReview and ExcellenceShippingMethod. All these 3 javascript class are defined in removecheckout.js file.

Step3: Javascript Files

The source code the javascript file removecheckout.js is below

var Excellence = Class.create(Checkout, {
	initialize: function($super,accordion, urls){
		$super(accordion, urls);
		//New Code Addded
		this.steps = ['login','billing', 'shipping', 'shipping_method', 'review'];
var ExcellenceShippingMethod = Class.create(ShippingMethod , {
	initialize: function($super,form, saveUrl){
		$super(form, saveUrl);
	nextStep: function(transport){
        if (transport && transport.responseText){
                response = eval('(' + transport.responseText + ')');
            catch (e) {
                response = {};

        if (response.error) {
            return false;
var ExcellenceReview = Class.create(Review,{
	initialize: function($super,saveUrl, successUrl, agreementsForm){
		$super(saveUrl, successUrl, agreementsForm);
	save: function(){
        if (checkout.loadWaiting!=false) return;
        var params = 'payment[method]=free';
        if (this.agreementsForm) {
            params += '&'+Form.serialize(this.agreementsForm);
        } = true;
        var request = new Ajax.Request(
                onComplete: this.onComplete,
                onSuccess: this.onSave,
                onFailure: checkout.ajaxFailure.bind(checkout)

There is not much to explain here except one important thing, in the ExcellenceReview class, i have put in the code

var params = 'payment[method]=free';

Here ‘free’ is the code of the payment method i am setting as default. So, if you setting some other payment method you need to put in that payment method’s code.

Step5: Controller

We need to override the default OnepageController.php and place in new code inside the saveShippingMethodAction() action. Here what we need to do is, set the payment method ‘free’ into the quote object when the shipping step is completed, and then redirect directly to the review step. So code to be added is

					$data = array('method'=>'free');
					$result = $this->getOnepage()->savePayment($data);
					$redirectUrl = $this->getOnepage()->getQuote()->getPayment()->getCheckoutRedirectUrl();
					if (empty($result['error']) && !$redirectUrl) {
						$result['goto_section'] = 'review';
						$result['update_section'] = array(
	                    'name' => 'review',
	                    'html' => $this->_getReviewHtml()
					if ($redirectUrl) {
						$result['redirect'] = $redirectUrl;
				} catch (Mage_Payment_Exception $e) {
					if ($e->getFields()) {
						$result['fields'] = $e->getFields();
					$result['error'] = $e->getMessage();
				} catch (Mage_Core_Exception $e) {
					$result['error'] = $e->getMessage();
				} catch (Exception $e) {
					$result['error'] = $this->__('Unable to set Payment Method.');

Details are found in the module.

Step6: Override the Free Payment Method

This is a special step required, only when using the ‘free’ payment method only. By default in magento, the ‘Free’ payment is available only when order total is zero. So we need to change this in the Free Payment method class, so as to allow it in our case also.
So the class Mage_Payment_Model_Method_Free is overriden by Excellence_Remove_Model_Method_Free and the function

public function isAvailable($quote = null)
		return true;

is used instead of default

public function isAvailable($quote = null)
        return parent::isAvailable($quote) && (!empty($quote))
            && (Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) == 0);

After doing this everything should work fine and payment method will not show up in checkout

Magento Onepage Checkout  - Remove Payment Step

Magento Onepage Checkout – Remove Payment Step

Step7: Email

Next we need to remove the payment block from the email sent as well. This is very simple, open you email template files usually located at
1. app\locale\en_US\template\email\sales\order_new.html
2. app\locale\en_US\template\email\sales\order_new_guest.html
Find this code in the template files {{var payment_html}} and remove it.

That’s it, these are all the steps required.