I am trying to set particular payment method in Magento session programatically in methods.phtml. I know how to retrieve current selected payment method from Magento session using getSingleton. But I am not able to find out how to override the existing selected payment method in the session.
I want to directly update the session variable for payment method. Is there anything like Mage::getSingleton('checkout/session')->setMethod('$method'). I have tried every other solution. If there is any function like this then please help me.

  • I just want to set payment method in magento session programatically .. Nov 12, 2013 at 13:50

2 Answers 2


I'm not sure I understand your question, but here goes. You can try this:

$quote = Mage::getSingleton('checkout/session')->getQuote();
$methodCode = 'payment_code_here';
if ($quote->isVirtual()) {
} else {

Looking at your code I noticed you are putting your variable in quotes. Not sure if you noticed that or not but it should look like.




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.