I would like to trigger an email after I change the package payment status from pending to paid. When customers book a package from me, it goes to pending first, then I'll manually change it to Paid after they've paid me offline. I tried putting this code in my functions.php, but it did not work, will you be able to tell me if any of my syntax is wrong?
function send_payment_confirmation_email($packageCustomer, $status) { // Debug the data structure error_log(print_r($packageCustomer, true)); error_log("New Status: " . $status);
// Check if the new status is "paid" if ($status === 'paid') { // Fetch customer details $customerEmail = $packageCustomer['customer']['email']; $customerName = $packageCustomer['customer']['firstName'] . ' ' . $packageCustomer['customer']['lastName']; $packageName = $packageCustomer['package']['name'];
// Email content $subject = 'Payment Confirmed for Your Package'; $message = " <p>Dear $customerName,</p> <p>Your payment for the package '<strong>$packageName</strong>' has been successfully confirmed.</p> <p>Thank you for your purchase!</p> "; $headers = ['Content-Type: text/html; charset=UTF-8'];
// Send the email wp_mail($customerEmail, $subject, $message, $headers); } }
// Add the action to trigger the function add_action('amelia_after_package_customer_status_updated', 'send_payment_confirmation_email', 10, 2);
We can ask our dev for an opinion so that they can take a look but in general they do not take customization projects. Once we receive feedback from them we will reach out to you again on this ticket.
We will forward this to our De team but we can not make any promises and as soon as we receive feedback from them we will reach out to you again on this ticket.
We just got the feedback from our colleagues and they have told us that if you are updating the payment on the finance page, you should use the hook amelia_after_payment_updated
The hook “amelia_after_package_customer_status_updated” is used when a package status, not payment status, is updated from open to canceled or canceled to open, on the manage packages page.
We wish you all the best and hope you have a wonderful day ahead.
Hello,
I would like to trigger an email after I change the package payment status from pending to paid. When customers book a package from me, it goes to pending first, then I'll manually change it to Paid after they've paid me offline. I tried putting this code in my functions.php, but it did not work, will you be able to tell me if any of my syntax is wrong?
function send_payment_confirmation_email($packageCustomer, $status) {
// Debug the data structure
error_log(print_r($packageCustomer, true));
error_log("New Status: " . $status);
// Check if the new status is "paid"
if ($status === 'paid') {
// Fetch customer details
$customerEmail = $packageCustomer['customer']['email'];
$customerName = $packageCustomer['customer']['firstName'] . ' ' . $packageCustomer['customer']['lastName'];
$packageName = $packageCustomer['package']['name'];
// Email content
$subject = 'Payment Confirmed for Your Package';
$message = "
<p>Dear $customerName,</p>
<p>Your payment for the package '<strong>$packageName</strong>' has been successfully confirmed.</p>
<p>Thank you for your purchase!</p>
";
$headers = ['Content-Type: text/html; charset=UTF-8'];
// Send the email
wp_mail($customerEmail, $subject, $message, $headers);
}
}
// Add the action to trigger the function
add_action('amelia_after_package_customer_status_updated', 'send_payment_confirmation_email', 10, 2);
Hello there,
Thank you for reaching out to us.
We can ask our dev for an opinion so that they can take a look but in general they do not take customization projects. Once we receive feedback from them we will reach out to you again on this ticket.
Kind Regards,
Marko Davidovic
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hey Marko,
Yes please, that would be really helpful! I apologise for that!
Hello again,
We will forward this to our De team but we can not make any promises and as soon as we receive feedback from them we will reach out to you again on this ticket.
Kind Regards,
Marko Davidovic
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Hello again,
We just got the feedback from our colleagues and they have told us that if you are updating the payment on the finance page, you should use the hook amelia_after_payment_updated
WP Hooks - Payments - Amelia WordPress Booking Plugin
The hook “amelia_after_package_customer_status_updated” is used when a package status, not payment status, is updated from open to canceled or canceled to open, on the manage packages page.
We wish you all the best and hope you have a wonderful day ahead.
Kind Regards,
Marko Davidovic
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables