mail number fixed
This commit is contained in:
parent
5a781d9639
commit
95fd8fefa1
30
mailer.js
30
mailer.js
@ -74,27 +74,39 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
|||||||
|
|
||||||
// --- 3. Billing Address Details HTML ---
|
// --- 3. Billing Address Details HTML ---
|
||||||
const billing = orderData.billing_address || {};
|
const billing = orderData.billing_address || {};
|
||||||
const contactNumber = orderData.note_attributes?.find?.((attr) => attr.name === 'Contact Number')?.value
|
|
||||||
|| orderData.attributes?.['Contact Number']?.contact_phone
|
// Get separate numbers
|
||||||
|| orderData.attributes?.['Contact Number']
|
const contactNumber = orderData.contact_number || orderData.phone;
|
||||||
|| orderData.contact_phone
|
|
||||||
|| orderData.attributes?.contact_phone;
|
const whatsappNumber =
|
||||||
|
orderData.whatsapp_number ||
|
||||||
|
orderData.attributes?.['Whatsapp Number'];
|
||||||
|
|
||||||
let billingAddressHtml = '';
|
let billingAddressHtml = '';
|
||||||
|
|
||||||
if (billing.first_name || billing.last_name) {
|
if (billing.first_name || billing.last_name) {
|
||||||
billingAddressHtml += `${billing.first_name || ''} ${billing.last_name || ''}<br/>`;
|
billingAddressHtml += `${billing.first_name || ''} ${billing.last_name || ''}<br/>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (billing.address1) billingAddressHtml += `${billing.address1}<br/>`;
|
if (billing.address1) billingAddressHtml += `${billing.address1}<br/>`;
|
||||||
if (billing.address2) billingAddressHtml += `${billing.address2}<br/>`;
|
if (billing.address2) billingAddressHtml += `${billing.address2}<br/>`;
|
||||||
|
|
||||||
if (billing.city || billing.province || billing.zip) {
|
if (billing.city || billing.province || billing.zip) {
|
||||||
billingAddressHtml += `${billing.city || ''} ${billing.province || ''} ${billing.zip || ''}<br/>`;
|
billingAddressHtml += `${billing.city || ''} ${billing.province || ''} ${billing.zip || ''}<br/>`;
|
||||||
}
|
}
|
||||||
if (billing.country) billingAddressHtml += `${billing.country}<br/>`;
|
|
||||||
if (billing.phone || orderData.phone) {
|
if (billing.country) {
|
||||||
billingAddressHtml += `${billing.phone || orderData.phone}`;
|
billingAddressHtml += `${billing.country}<br/>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show contact number
|
||||||
if (contactNumber) {
|
if (contactNumber) {
|
||||||
billingAddressHtml += `<br/>Contact: ${contactNumber}`;
|
billingAddressHtml += `Contact: ${contactNumber}<br/>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show WhatsApp number separately
|
||||||
|
if (whatsappNumber) {
|
||||||
|
billingAddressHtml += `WhatsApp: ${whatsappNumber}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const paymentMethod = orderData.gateway || 'Request Quote';
|
const paymentMethod = orderData.gateway || 'Request Quote';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user