When A user For the first time, tried to book then, we have added customer id in the note field of customer menu of Amelia in admin area and for notification we have setup the text of mail and we have added %customer_note% in mail but for the first time that note field value is not being displaying or display empty and we added the customer id by using below code:
function amelia_booking_added_hook($reservation, $bookings, $container) { global $wpdb; $id = $bookings[0][‘customerId’]; //1000 $customerNote = $wpdb->get_var( “SELECT note FROM wp_amelia_users WHERE id = $id” ) ?: ”; $customerWpId = $wpdb->get_var( “SELECT externalId FROM wp_amelia_users WHERE id = $id” ); $userId1000 = get_user_meta( intval($customerWpId), ‘user_id_1000’, true); $nowDateTime = new DateTime(‘now’); //if (empty($customerNote)) { $customerNote = $userId1000 . PHP_EOL; //}
we have attached that note field value by using %customer_note% short code code in mail setup or notification setup but for the first time if user or customer book then in mail note field value is not coming or is not displaying
Hello,
When A user For the first time, tried to book then, we have added customer id in the note field of customer menu of Amelia in admin area and for notification we have setup the text of mail and we have added %customer_note% in mail but for the first time that note field value is not being displaying or display empty and we added the customer id by using below code:
function amelia_booking_added_hook($reservation, $bookings, $container) {
global $wpdb;
$id = $bookings[0][‘customerId’]; //1000
$customerNote = $wpdb->get_var(
“SELECT note FROM wp_amelia_users WHERE id = $id”
) ?: ”;
$customerWpId = $wpdb->get_var(
“SELECT externalId FROM wp_amelia_users WHERE id = $id”
);
$userId1000 = get_user_meta( intval($customerWpId), ‘user_id_1000’, true);
$nowDateTime = new DateTime(‘now’);
//if (empty($customerNote)) {
$customerNote = $userId1000 . PHP_EOL;
//}
$wpdb->update(‘wp_amelia_users’, [‘note’ => $customerNote], [‘id’ => $id]);
}
add_action(‘AmeliaBookingAdded’, ‘amelia_booking_added_hook’, 10, 3);
we have attached that note field value by using %customer_note% short code code in mail setup or notification setup but for the first time if user or customer book then in mail note field value is not coming or is not displaying
Hi, Ajay!
Sorry for the delayed response.
Where do you get the Customer note from? Could you please describe the process of first booking and note creation briefly? Step by step.
Best regards.