Needs review
Project:
Commerce Core
Version:
3.x-dev
Component:
Order
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
7 Jun 2017 at 20:36 UTC
Updated:
14 Apr 2026 at 14:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
bojanz commentedMight also make sense in the user's order view, at least if the payment is not complete yet.
Comment #3
vasikeHere is patch for this.
For this I added extra "payment_instructions" variable the commerce_order_receipt theme.
Comment #4
iki_cz commentedDunno, how to display payment instructions on user's order view, but @vasike's patch for payment instructions is working fine (in order to show payment info at order receipt). RBTC
Comment #5
iki_cz commentedTested on clean D8 + Commerce installation.
Comment #6
iki_cz commentedHere is updated version of patch #3, that reflects current 8.x-2.x-dev version.
There was an error with #3 patch after 8.x-2.x update:
Recoverable fatal error: Argument 1 passed to Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\Manual::buildPaymentInstructions() must implement interface Drupal\commerce_payment\Entity\PaymentInterface, none given, called in /var/www/clients/client1/web155/web/web/modules/contrib/commerce/modules/payment/commerce_payment.module on line 179 and defined ve funkci Drupal\commerce_payment\Plugin\Commerce\PaymentGateway\Manual->buildPaymentInstructions() (řádek 72 souboru /var/www/clients/client1/web155/web/web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/PaymentGateway/Manual.php) #0 /var/www/clients/client1/web155/web/web/core/includes/bootstrap.inc(566): _drupal_error_handler_real(4096, 'Argument 1 pass...', '/var/www/client...', 72, Array) #1 /var/www/clients/client1/web155/web/web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/PaymentGateway/Manual.php(72): _drupal_error_handler(4096, 'Argument 1 pass...', '/var/www/client...', 72, Array) #2
Comment #7
mglamanWe have OrderReceiptTest. We should mimic one in Payment which verifies the information is added to the receipt. Without a test we have no idea if this works or not.
Looks like whitespace and tab errors.
Comment #8
bbuchert commentedJust tested the patch in #6 and it works well.
Comment #9
finex commentedI will try the patch, it's exactly what I'm looking for.
P.S The payment should also be visible on the order page for the backend users without needing to click on "payments" tab. :-)
Comment #10
finex commentedHi, I've updated the patch adding the payment gateway. What do you think?
Comment #11
netzkombuese commented#10 was exactly what we needed. Works fine so thanks for that.
Comment #12
finex commentedHi, does the patch need more work or can it be applied?
Comment #15
fenstratAttached adds a kernel test as requested in #7.
It also removes the payment gateway from #10 as I'm not sure of the value of that? This also brings it into line with what is displayed on the checkout completion message (i.e. just the payment instructions).
Comment #16
hockey2112 commented#10 worked for me. Thanks!
Comment #17
introfini commented#15 worked perfectly, thanks!
Comment #18
jon pollard commentedHI, it looks like this patch is no longer applying to the latest 8.x-2.x-dev version as of 21/02/2020
Comment #19
fenstratHere's a re-roll for 8.x-2.x-dev.
Comment #21
fenstratRe-roll of #19, and also to kick the tests off again as the fails look unrelated.
Comment #23
filipetakanap commentedI need a patch of this for drupal 9 =(
Comment #24
jsacksick commentedWhat if the order is already paid? What's the point of showing payment instructions in this case?
Comment #25
paulo.faria commentedAny updates for Drupal 9?
Comment #26
petiar commentedCorrect me if I am wrong, but if there is no payment for the order at all, then the
$payments = $payment_storage->loadMultipleByOrder($order);in patch #15 results in an empty array, so no payment instructions will be displayed. And no payment is exactly the case when we want payment instructions to be displayed, right?
I am on Drupal 9.
Comment #29
agoradesign commented@petiar: no, a payment gateway can implement a certain interface (I think it's called HasPaymentInstructionsInterface) in order to be able to show payment instructions to the user. A classic example is the Manual payment, where you display the instructions to pay to bank account XY. In this case, we do have a payment entity, but it's state is that it's not paid at that moment
Comment #30
jglynn commentedAny patch for Drupal 9?
Comment #31
nchase commentedI tested the patch #21 in Drupal 10 and it is working. Thank you!
Comment #32
nchase commentedI'd like to add that this feature is really important. When using manual payments like a bank transfer, where you provide the bank account details and the reference-number, it is important that all those payment details are within the mail and not just once on the website. I consider it a must-have.
Comment #33
newaytech commentedUpgrading from - drupal/commerce (3.2.0 => 3.3.2): - and noticed all the new hook syntax coming into play.
The patch we have here has therefore failed to apply. Could we perhaps ask for a re-roll if still relevant?
Think it's just 2 x; order & payment module files effected.
Comment #34
fenstratAlso his this not applying to commerce 3.3.2.
Re #24 "What if the order is already paid? What's the point of showing payment instructions in this case?" - probably a fair point. However the approach here adds the payment instructions in exactly the same way as is done for the checkout completion message. And when it's done there it doesn't have any check for the order being paid.
Comment #35
fenstratOdd, when I try and create a new branch from 3.x in the issue for UI at the top of the issue, I get
Failed to create branch '2884497-payment-instructions': invalid reference name '3.x'.Attached is a patch version of what I'd planned to put into a MR based on 3.x. If someone else has more luck with that then this is probably ready for NR.
Comment #36
newaytech commentedThanks @fenstrat - but I think I may have been a little premature in my reporting... I see that your logic already appears in CommercePaymentThemeHooks ? I've removed the patch I used historically - and the functionality remains. Has it found it's way into the commerce module?
Comment #37
fenstrat@newaytech right, that's been there for a long time and is what displays this same payment instructions at checkout completion, i.e.
#[Hook('preprocess_commerce_checkout_completion_message')]. What this issue is about is adding the same thing to the order receipt emails, i.e.#[Hook('preprocess_commerce_order')].Comment #38
newaytech commented@fentstrat - OK, good stuff. We re-use the hooks and duplicate an exact same receipt include for both browser page and email. I've removed the patch - but thank you for the help regardless...
Comment #42
idebr commentedPatch #35 is now available as merge request: https://git.drupalcode.org/project/commerce/-/merge_requests/663