Till now, I have been using only PayPal checkout on my Commerce site, and I have configured the checkout flow so all of the customer's information is collected over on PayPal's site.

However, I am now trying to add Stripe as an alternate payment method. I need to collect the customer's billing info on my site when using Stripe, so I need to add Billing information to the checkout pane.


  • Show Billing information if the customer selects Stripe as the payment method. If the customer selects PayPal, do not show Billing information.

I looked through the various commerce events and actions available in the Rules module, but I couldn't find anything that is helpful for this case.

4 Answers 4


There is no way just through Rules to influence the visibility of a checkout pane. Instead, you'll need to use hook_form_alter() and hook_commerce_checkout_pane_info_alter(). Why both?

You have to use the form alter to remove or disable the billing information checkout pane when you detect PayPal has been selected, which means you also need the payment method selection to be first (and, in the most simplest case, on its own page).

You have to use the checkout pane info alter to set your own validate and submit callbacks for the billing information checkout pane. These should also check the payment method and only invoke the default callbacks if the proper payment method was selected. The reason for this step is that the checkout form validates / submits checkout panes based on where they're configured to appear in the checkout form, not based on whether or not they were actually present on the finally rendered form. You can alter a pane out of the checkout form's array, but its default validate callback will still process it as if it had been there.

To determine what payment method was selected, look in $order->data['payment_method'].


This would need to implement hook_form_alter() on your checkout form. You should be able to toggle hidden or not for that pane. From my own experience, you may need to wrap the div you're hiding in another div to have it reappear after hiding it. EG: when a customer is toggling between those two payment methods.

  • Good advice, daviedos. Didn't see your answer because I took too long to submit the open tab. : P Commented Jan 20, 2015 at 2:01

Go to checkout settings page, drag "Billing information" to the disabled section.

  • I'm not trying to always disable the billing information; I only want to do that if PayPal is active. Commented Jun 7, 2015 at 11:04

There is actually a way to set checkout pane visibility via rules.

You can use the Commerce Rules Extra module.

You then should be able to use the "Process checkout pane" event and have a condition to check the payment method that has been selected (stolen from Ryan's post this should be in the data array - $order->data['payment_method']) and an action to change the pane visibility settings.

This is only really going to be user friendly if your payment type checkout pane comes early in the checkout process. In this case having that first up seems logical.

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.