Hello,
I've finally ended up creating a new issue, because this issue is driving me crazy. Working on commerce_funds I'm trying to implement a new plugin class for PaymentInformation. The issue is that the checkout flow never goes to the process payment. I can complete it and ends up to the completion message but it just jumps over the payment process.
As requested in the comment (Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase\PaymentInformation) I have implemented hook_commerce_checkout_pane_info_alter(array &$panes) to point payment_information to my class, but still, it doesn't work.
The plugin DepositPaymentInformation is an extension of PaymentInformation class and I'm basically just adding a bit of code to it, Otherwise, the class is the same.
Am I doing something wrong or is it a bug? I'm willing to help, but have investigated a lot already and still didn't get the full structure/relationship between the panes. From my investigations, it could be the call to the hook which is called too late. I've dumped the variables from the checkout controller on "review" page in attachment (same as the other screenshot).
Any help, guidance, will be appreciated.
Thanks.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | Class_overriden.png | 136.72 KB | aporie |
| #8 | checkout_flow.png | 57.98 KB | aporie |
| Screenshot_20190102_095852.png | 94.09 KB | aporie | |
| commerce_checkout.png | 154.67 KB | aporie |
Comments
Comment #2
bojanz commentedI have trouble seeing what's actually going wrong. Could you try describing again?
Also, can you share your hook?
Comment #3
aporieWhen being at the Review pane, whereas having the option to pay and complete the order, I just have the "complete checkout" form submit button. So no payment is made.
Here is my hook :
I've changed every parameter just for testing.
Comment #4
aporieComment #5
bojanz commentedYou must not change $panes['payment_information']['id'], the whole point of the alter hook is to replace the class without changing the ID.
Comment #6
aporieYeah, the result is the same if I just alter the "class". So I think it's probably an issue. I wasn't sure I wasn't doing something wrong.
You know where this hook lives?
Comment #7
bojanz commentedIt's fired by CheckoutPaneManager, but it's essentially core plugin code. We've had no issues with the hook so far.
Make sure that DepositPaymentInformation doesn't have an annotation of its own.
If it does, you might have have accidentally configured your checkout flow to use that pane instead of the original Payment information one.
Comment #8
aporieBut yes I do, I've implemented it like a new plugin as it was what I wanted to achieve.
I want to replace PaymentInformation pane by DepositPaymentInformation pane. Indeed I could alter the default pane but I want to make specific entities and plugin for commerce_funds as it'll give me more flexibility in case I need them in the future.

I feel like this hook is fired and then overwritten by something which put it to its first value. I think an easy way to reproduce the issue is to make any custom plugin which extends PaymentInformation and to put it in the checkout flow in place of PaymentInformation, you'll end up jumping over the payment process ...
Comment #9
bojanz commentedYour screenshot confirms that your checkout flow is misconfigured.
"Payment information" is supposed to be enabled. That is the entry that you're pointing to your class via the alter hook.
"Deposit payment information" should not be enabled (and is better off not shown altogether).
Comment #10
aporieOk, I think I got the logic but still doesn't work.
I have re-enabled PaymentInformation as the pane for "order information". I still have my hook altering the class to DepositPaymentInformation. I've tried with
- DepositPaymentInformation as a plugin (with annotation) and disabled.
- DepositPaymentInformation as a regular class (without annotation).
It seems that it's just PaymentInformation pane which comes. I don't have my changes from my custom class.
On the attached picture, we should see the fees applied to each deposit payment method next to them.
Thanks for your time, it's been two days I'm on this ...
Comment #11
aporieHey,
So, it has finally worked after reinstalling the module. It seems that clearing all caches is not enough. Thanks for the help.
For others, the way to override PaymentInformation is :
- Make a Class which extends PaymentInformation (no need to make a plugin, the class is needed to override PaymentInformation).
- Override PaymentInformation in the checkout flow with hook_commerce_checkout_pane_info_alter(array &$panes) {
$panes['payment_information']['class'] = 'Path\To\YourNewClass';
}
[Edit] Thanks for noticing. Indeed.
Comment #13
cameron prince commentedIn comment #11, the path to your class shouldn't use forward slashes... i.e. should be $panes['payment_information']['class'] = 'Path\To\YourNewClass';
Comment #14
mykola dolynskyiAlso having same problem for 1+ day.
So, does it mean that it is not possible to create custom PaymentInfo (and may be PaymentProcess?) plugin in a cool way where you pick required Panes via Commerce UI? Only must hardly replace class of core 'payment_information' in hook? Even with custom CheckoutFlow not possible?
UPDATE: found solution, see below ( https://www.drupal.org/project/commerce/issues/3023373#comment-14149243 )
Comment #15
mykola dolynskyi@Aporie , you can use your custom PaymentInformation in way you planned (without hook):
but must create custom PaymentProcess also (and enable it in GUI)
tested this right now, is working
Comment #16
aporieHi Mykola,
Thanks for the update.
I'll take a look when I have a bit of time.