0

So for my project there will only ever be one payment method with is Credit Card by Sage Pay.

Essentially I want to remove the pane where you select a payment method and set the payment method always as Sage Pay. I want to hide payment selection from the user.

This way after entering user details the user can go straight to the payment gateway redirection. How would I go about this?

2 Answers 2

1

You'll need a custom module with the following function:

function yourmodule_form_commerce_checkout_form_checkout_alter(&$form, &$form_state, $form_id) {
 // Do something here
}

You'll probably want to add a dpm($form); (assuming you have Devel installed) to get the exact item, but the array you'll probably want to target is: $form['commerce_payment']['payment_method'] by perhaps setting the #access to FALSE if you only have one choice. In other words, add the following: $form['commerce_payment']['payment_method']['#access'] = FALSE;

Be sure to clear the cache after adding this function.

1
  • @slawrence10, can you comment what did/didn't work for you?
    – Webdrips
    Commented Oct 22, 2012 at 18:17
1

Go to Administration >> Checkout settings (admin/commerce/config/checkout). Move the payment method pane to Disabled region and save setting.

Payment inside disabled region

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.