The problem
As mentionned in this issue : #3420031: Use payment gateway display label instead of payment method label, stored payment methods use the payment method label as payment option label.
This label in build by the buildLabel() method in PayPalCheckout payment method. When no card_type is stored in the payment method (typically when we go back to the previous checkout step), the function return "Paypal" by default. I think it is a bad behaviour because of this issue : #3154770: Remove duplicate PayPal payment method options in checkout.. I'll explain : the condition added in this issue removes the "default" Paypal payment option when a Paypal payment method is already stored. But the label of these 2 options is not created the same way :
- One is made with the payment method label
- The other one is made with the payment gateway display label
So when I choose Paypal, that I go to the review step then I go gack on the previous checkout step, the label changed. In my site, the display label of my Paypal gateway is not just "Paypal", this is why I noticed the change.
It is not a major issue but I think it is missconfusing.
Proposed resolution
Use the payment gateway display label as default return value of the buildLabel() method, instead of just "Paypal".
Comment | File | Size | Author |
---|---|---|---|
#3 | 3420132-2.patch | 1002 bytes | jsacksick |
Issue fork commerce_paypal-3420132
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
Comment #2
solene_ggd CreditAttribution: solene_ggd at Maetva commentedComment #3
jsacksick CreditAttribution: jsacksick at Centarro commentedLet's see if this patch helps.
Comment #4
solene_ggd CreditAttribution: solene_ggd at Maetva commentedWell this is exactly what I needed ! Thank you for your quick response and your patch (I was about to upload mine but yours is better !)
Comment #5
solene_ggd CreditAttribution: solene_ggd at Maetva commentedI have to apologize @jsacksick because this isn't a real issue for now. I thought it was the display label that was used in payment option but it is actually the create_label (because it is a payment gateway with payment method) which is "Paypal".
I had the problem because I had installed this patch : https://www.drupal.org/project/commerce/issues/3250069#comment-14649769
However, the current patch might still be useful if this parent issue is ever resolved.
Comment #6
trickfun CreditAttribution: trickfun commentedPatch doesn't work.
The label is always paypal.
While patch https://www.drupal.org/project/commerce/issues/3250069#comment-14649769 works fine.
Thank you
Comment #12
jsacksick CreditAttribution: jsacksick at Centarro commentedThis is now fixed, but the Commerce core patch is needed in Commerce 2.x, or Commerce 3 is going to have to be used.