In magento you can disable checkout for guests completely. However, what I would like is if customer chooses to checkout as a guest then they can only checkout via paypal standard. But, if they choose to register and checkout then they have the option of being able to checkout with paypal or purchase order.

Would this even be possible? I am using a theme based on the default RWD theme.


I'd suggest using an observer on the payment_method_is_active event. This fires just before Magento renders the payment methods in the checkout, enabling you to step in and switch methods on and off as you please.


In this observer you'd need to check the payment method instance against the payment method you want in this case "purchaseorder"

public function disablePurchaseOrders(Varien_Event_Observer $observer) 
  $paymentMethodCode = $observer->getEvent()->getMethodInstance()->getCode();
  if ($paymentMethodCode === 'purchaseorder') { 

Also check if the customer is a guest

    if (!Mage::getSingleton('customer/session')->isLoggedIn()) {

Then disable the payment method

       $result = $observer->getEvent()->getResult();
       if ($result->isAvailable) {
        $result->isAvailable = false;

Here's a module I wrote that disables payment methods based on delivery address. It's a little more complicated than what you need as it sets admin fields to enable/disable for each payment method and allow users to select which contries to do this for. Hopefully it will get you started. https://github.com/peacockcarter/magento-filter-payment-methods-on-shipping-address

  • works after adding the class decleration in Observer.php, see my edit. But, now if I select register and checkout the Purchase Order option doesn't show. Is there a way I can alter this so if register and checkout selected in step 1 of onepage checkout the purchase order option will display. – Vaishal Patel Mar 10 '17 at 14:17
  • also I have noticed this now doesn't display the Purchase order payment method in when creating orders via Magento admin. – Vaishal Patel Mar 15 '17 at 16:59
  • I have solved this by replacing the observer to check by checkout method instead of them being logged in or not. – Vaishal Patel Mar 17 '17 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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