Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Can you add a hook to the _commerce_invoice_receipt_get_invoice_info() function that would allow modules to add extended data to the $info variable?
For example, I have added a comments field to the order and need to add this data to the $info variable so that it can be output in the invoice.
Comment | File | Size | Author |
---|---|---|---|
#8 | commerce_invoice_receipt-add-hook-to-invoice-info-2043461-8.patch | 638 bytes | KarlShea |
Comments
Comment #1
rbrownell+1 on that...
I would almost suggest creating an area on the invoice receipt where other modules can fill in whatever they need to fill in, say after the order total and before the remarks/terms and conditions text area at the bottom.
At Commerce Moneris we are discussing about how we would grant access to transaction data to display mandatory response codes by the Moneris payment processor. It was suggested that a hook with your module might do the trick. #1941334: Retrieving and saving data from Moneris response
Comment #2
Scott Robertson CreditAttribution: Scott Robertson commentedA patch is attached that will add a drupal_alter call right before the invoice info is returned, allowing other modules to add other data to it.
Comment #3
spheresh CreditAttribution: spheresh commentedPatch was updated for 7.x-1.1 version of module
Comment #4
3CWebDev CreditAttribution: 3CWebDev commentedAwesome. Can we get this committed to the module?
Comment #5
spheresh CreditAttribution: spheresh commentedA small fix. Order was added to the alter function. It is more useful because, there was hard to add something in template without an information about the order
Comment #6
spheresh CreditAttribution: spheresh commentedIt is same patch for version 1.1 of module (sorry but I need it for my project)
Comment #7
JulienF CreditAttribution: JulienF commentedQuite Helpful,
Thanks!
Comment #8
KarlSheaAlso added the $build parameter from the original function. This contains the rendered fields from the Invoice/Receipt display settings on the Order so you can add fields to the $info array the same as _commerce_invoice_receipt_get_invoice_info() does.
Comment #10
aramboyajyan CreditAttribution: aramboyajyan commentedI'm a bit late to the party, and I should have checked this issue before #2665680: Implements hook system for _commerce_invoice_receipt_get_invoice_info, but I'm here to fix things :D
Thanks everyone! This has been committed to v2 over the patch provided in the newer issue.