Create an order in admin with free payment method

As you’re probably aware, if you use PayPal as your payment processor, you can’t create a new order in the backend (admin) and process a payment.

You’ll notice that you get all the way through the order but there’s no payment method available and therefore the error message appears “payment method required”

There’s a workaround available if you don’t use the free or “No Payment Information Required” payment method enabled.

This change will allow you to process the order but you’ll still need to capture the actual payment via another means. If the order is actual no-cost, there’s no issue (ie sending out replacement product, parts, brochures etc)

Copy the following file:

app/code/core/Mage/Payment/Model/Method/Free.php

to:

app/code/local/Mage/Payment/Model/Method/Free.php

Make the following changes starting around line 48:

(1) add the 2 lines below canAuthorize

(2) change the line containing getGrandTotal


/**
* Payment Method features
* @var bool
*/
protected $_canAuthorize = true;
protected $_canUseInternal = true; // added for admin function
protected $_canUseCheckout = false; // added for admin function

/**
* Payment code name
*
* @var string
*/
protected $_code = 'free';

/**
* Check whether method is available
*
* @param Mage_Sales_Model_Quote|null $quote
* @return bool
*/
public function isAvailable($quote = null)
{
return parent::isAvailable($quote) && !empty($quote)
// && Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) == 0;
&& Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) >= 0;
}

 

The first 2 changes disable the method for frontend/customer checkout and the 2nd change allows the method for any total amount in the admin order.

  • Upload your changes
  • go to system -> configuration -> Payment Methods
  • Enable the Free Payment option (you can rename as you wish but the new name will appear on any copy emailed or viewed by the customer)
  • Save your changes and clear the cache

Now when you go to create an order in admin, this payment method should appear and will allow you to proceed and complete the order.

 

Leave a Reply