0

I just set up Drupal Commerce (not Kickstart) and am using the Commerce PayPal module to allow customers to pay for their orders. This is the only payment method available; however, there is a radio button displayed next to PayPal, as if there was another option that could be selected (although there is not).

How can I hide this option? I assume there is an option in the UI somewhere that I missed, because it is not standard practice to show a radio button when no choice is in fact possible.

It looks like this:

payment with radio button

4

Here is a more elegant way:

function yourmodulename_form_commerce_checkout_form_review_alter(&$form, &$form_state, $form_id) 
{
   $form['commerce_payment']['#access'] = FALSE;
}

I'm not confident if the payment selector might be put into another form in checkout settings. Then it might be part of the commerce_checkout_form_checkout_alter instead. Then do this:

function yourmodulename_form_commerce_checkout_form_checkout_alter(&$form, &$form_state, $form_id) 
{
    $form['commerce_payment']['#access'] = FALSE;
}
| improve this answer | |
  • 1
    This functionality might be turned into a module one day, or be part of commerce. Follow the issue here: drupal.org/node/1854062#comment-7786499 – rosell.dk Aug 23 '13 at 10:56
  • I tried these methods in D7 commerce kickstart in a little custom module created for the purpose. The first removed the whole payment form, not just the radio button. This left the user with no way to submit their payment details. The second function did not appear to do anything. Has anyone else got this code to work? – Paul Trotter Nov 26 '13 at 14:47
3

There is no way to remove that option as it suppose to be a select box widget. Your best bet is to hide it via css. just target it via the input element and do a display none.

any issues this might be a guide on styling radio buttons via css: http://www.andreapinchi.it/how-to-style-radio-buttons-with-pure-css/

| improve this answer | |
0

Here's my solution for this (based on a comment above https://drupal.stackexchange.com/a/83460/31913):

function yourmodulename_form_commerce_checkout_form_review_alter(&$form, &$form_state, $form_id) {
  $form['commerce_payment']['payment_method']['#type'] = 'markup';
}

All we need is to change type from 'radios' to 'markup' and this does the trick.

Hope this helps.

| improve this answer | |

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.