In the final magento checkout page, at the payment method part, I have two options, SagePay and PayPal.

Neither are selected, but I would like the SagePay option preselected by default, and therefore load automatically without the customer having to select anything.

3 Answers 3


If you are using Onepage Checkout you can edit app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php -> public function getSelectedMethodCode() and to change:

return false;


return parent::getSelectedMethodCode(); //if you like to select the first payment method


return 'code_of_the_payment'; //the code of the payment that you like, I don't know what is for SagePay

It's recommended to create a module that rewrites this class or at least copy the file in app/code/local and edit the copy.

  • As much as I am not a fan of editing "Core" as it's not a good practice, but your solution does what I was trying to achieve.
    – Benjamin
    Commented May 1, 2017 at 10:21
  • How this can be achieved on Magento 2 for multiple countries?? Commented Mar 23, 2020 at 8:05

Easiest solution is goto methods.phtml at app>design/frontent/yourpackage/your template/template/checkout/onepage/payment/

AND find

<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
        <?php $oneMethod = $_code; ?>

and here you need put your logic.

<?php if($_code=='yourpayemntcode'): ?> checked="checked"   <?php endif;?>
  • How this can be achieved on Magento 2 for multiple countries?? Commented Mar 23, 2020 at 8:05
  • This could cause problems if another payment method was already selected for the current checkout session/quote Commented Mar 31, 2021 at 11:16

You can set sorting order for payment (and shipping) methods in the admin backend. Under Configuration > Payment Methods you can select each available method and set the sort order to a lower number.

  • Unfortunately not all payment methods have a sort order field. PayPal being the first that springs to mind.
    – Andy
    Commented Dec 7, 2017 at 9:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.