Hi,

Problem

Currently, when there is only one payment gateway available, the checkout pane Payment information become empty. This is a little disturbing for users, who can't see the payment gateway. And because this empty fieldset. The first reaction is "hey what's the problem ? Why this empty pane" :-)

Proposal

Add a configuration option on the checkout pane payment_information, option which permit to always display payment gateway / method even if there is only a single gateway available for the current user.

CommentFileSizeAuthor
#2 2907504-2.patch3.09 KBflocondetoile

Issue fork commerce-2907504

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

flocondetoile created an issue. See original summary.

flocondetoile’s picture

Status: Active » Needs review
StatusFileSize
new3.09 KB

The patch to review.
Thanks

flocondetoile’s picture

Issue summary: View changes
grimreaper’s picture

Thanks for the patch.

Works for me! ;)

Here is my review.

+++ b/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php
@@ -23,6 +23,58 @@ class PaymentInformation extends CheckoutPaneBase {
+    if (!$form_state->getErrors()) {

Why this check? On the submitConfigurationForm method, the form has already been validated, no?

flocondetoile’s picture

In fact I wonder even if this need to be configurable. I don't understand why we should hide the payment method if there is only one method available. The customer should see what is the payment method available even if there is only one. Thoughts ?

bojanz’s picture

In general it doesn't make a lot of sense to show a single radio button to users. The assumption was this can happen only in specific circumstances:
1) You have a single off-site gateway.
2) You have a single on-site gateway, and you have no payment methods (so your only option is "Add credit card")

You appear to have a situation that wasn't considered: An on-site gateway where there are payment methods, but no option to add new. How does that happen? Gift cards?

I agree that if the single radio is a payment method, it's not a good idea to hide it, cause we're missing vital information, and such a thing doesn't need to be configurable.

flocondetoile’s picture

The use case was a single off-site gateway (Paypal to be more precise) for a DrupalCamp site.

In general it doesn't make a lot of sense to show a single radio button to users.

But you display an information to users about the gateway which will be used. It's a information which can have sens (Have I a paypal acocunt for example, before going to the payment step).

flocondetoile’s picture

Issue summary: View changes

Fixing issue summary / title (about payment gateway vs method)

flocondetoile’s picture

Title: Display payment method in the CheckoutPane Payment informations even if only single payement method available » Display payment method in the CheckoutPane Payment informations even if only single payment gateway available
Issue summary: View changes
bojanz’s picture

But you display an information to users about the gateway which will be used

I think that what you want is this issue: #2858179: Allow gateways to show text at checkout (in PaymentInformation). Gateway provided help text would be shown even if the radio selection is hidden.

I would need more community feedback before changing the current radio logic. It was made as a direct response to the 1.x community requests, such as #2505101: If only one (required) payment option, hide the selector. I'll ask people at DrupalCon Nashville.

init90’s picture

Thanks, @flocondetoile!

I have payment methods filtering based on product types added to the cart. In some cases may leave only one payment method and it looks quite confusing when the place, where early were shown payment methods, is empty.

odizle’s picture

I agree that having a single radion button does not make sense, but having an empty "Payment information" pane is confusing.
From a UX perspective, I think it's better to show the customer the payment option even is not selected and only one is available.

In my case, the website only accepts PayPal and since there is no need for a billing address, the "payment information" pane is empty which makes the page looks like something is missing.

no sssweat’s picture

In general it doesn't make a lot of sense to show a single radio button to users.

Totally agree!

I think it's better to show the customer the payment option even is not selected and only one is available.

Better yet, if there is nothing to fill or select, how about skipping the step altogether?

Assuming you only have 1 payment gateway then simply disable the "Payment information" pane in the checkout flow.

But if you have multiple payment gateways that may appear based on conditionals, then the previous paragraph wouldn't do. But perhaps if there is a way to programmatically skip the step if only 1 payment gateway shows up, that would be the desirable solution IMO.

rongok’s picture

Assuming you only have 1 payment gateway then simply disable the "Payment information" pane in the checkout flow.

If "Payment information" pane is disable in the checkout flow, orders are completed without processing any payments.

pslcbs’s picture

In my opinion it makes more than sense to show all the critical information to a customer, and payment gateway is in that club.

I think the solution on patch is the best way to, at least, have the option to display your single payment gateway to your customer.

Patch #2 works perfect for me, thanks!! ;-)

lukasss’s picture

+ 1 for this

littlepixiez’s picture

I definitely think we need to have a radio button appear for just one payment gateway. It looks like the checkout is broken if it is empty... And we don't necessarily want a description for our payment gateways either.

We need "PayPal" to appear so they can continue to the review step and know what they're committing to on the next step. They may not want to use PayPal, or may not even have it. I think it's crucial we display the payment gateway on this pane regardless of count.

Many ++++s for #2 being committed! :)

poker10’s picture

+1 for this patch and the configuration option. It is important to display such information to the Customer, otherwise it can cause confusion (why are payment methods missing?, what I have selected?, etc..).

kopeboy’s picture

Yep, seconding this as well.

In my case with bank transfer payment the user has no instructions before having completed the checkout, which is very confusing.

aasarava’s picture

+1 for the patch. This makes a lot of sense, especially if you're using something like PayPal as a gateway, which takes care of accepting payment via PayPal, Venmo, credit card, etc. Those aren't set up as multiple gateways -- it's all a single gateway as far as Commerce is concerned.

joe huggans’s picture

Tested this and it works well for me. Thanks

xperd’s picture

function MODULE_NAME_form_alter(&$form, \Drupal\Core\Form\FormStateInterface\FormStateInterface $form_state, $form_id) {
  if (isset($form['payment_information']) and (isset($form['payment_information']['payment_method']))) {
    $form['payment_information']['payment_method']['#access'] = true;  
  }
}
xperd’s picture

What needs to be done with the patch?

Customer must see available payment gateway, even if there is only one.

jsacksick’s picture

Version: 8.x-2.x-dev » 3.0.x-dev

jsacksick’s picture

Opened an MR against 3.0.x, patch had to be rerolled and made a few adjusments to it. If the tests are green, I'll commit the change.

  • jsacksick committed fb86b2c2 on 3.0.x
    Issue #2907504 by jsacksick, flocondetoile: Display payment method in...
jsacksick’s picture

Status: Needs review » Fixed

@flocondetoile: Committed the rerolled patch, thank you! 🎉

flocondetoile’s picture

Youhou ! My older issue I believe :-) Thanks !

ramlev’s picture

The patch also merges in 2.x branch. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.