0

I want to add a to order checkout emails the bank account details managed by commerce_bank_transfer module. I create a rule for the order with the bank transfer payment method but I'm not undertanding how to add in the mail my site's bank account infos.

I tryed to add this code to the email

<?php
   $payment_method = commerce_payment_method_load('bank_transfer');
   echo commerce_bank_transfer_bank_details($commerce_order->order_id, $payment_method);  
?>

I did some test and in the mail there is nothing where I was expecting my bank info.

Reading commerce_bank_transfer module I saw that commerce_bank_transfer_bank_details function request a 'setting' key in the $payment_method array but if I retry the payment method by

commerce_payment_method_load('bank_transfer');

I have no 'setting' key.

How can I retry the setting from a payment method?

2

I solve with this code:

<?php 
$payment_method = commerce_payment_method_instance_load($commerce_order->data['payment_method']);
echo commerce_bank_transfer_bank_details($commerce_order->order_id, $payment_method); 
?>

commerce_payment_method_instance_load() function need in input a string like

'bank_transfer|commerce_payment_bank_transfer'

and it returns a paymente method with all data [ setting included ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.