mail number fixed

This commit is contained in:
Selvi 2026-06-22 19:37:04 +05:30
parent 95fd8fefa1
commit 000b1ce970

View File

@ -75,12 +75,23 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
// --- 3. Billing Address Details HTML ---
const billing = orderData.billing_address || {};
// Get separate numbers
const contactNumber = orderData.contact_number || orderData.phone;
// Contact Number (from Contact field only)
const contactNumber =
orderData.note_attributes?.find?.(
(attr) => attr.name === 'Contact Number'
)?.value ||
orderData.attributes?.['Contact Number']?.contact_phone ||
orderData.attributes?.['Contact Number'];
// WhatsApp Number
const whatsappNumber =
orderData.whatsapp_number ||
orderData.attributes?.['Whatsapp Number'];
orderData.note_attributes?.find?.(
(attr) => attr.name === 'Whatsapp Number'
)?.value ||
orderData.attributes?.['Whatsapp Number'] ||
billing.phone ||
orderData.phone;
let billingAddressHtml = '';
@ -88,8 +99,13 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
billingAddressHtml += `${billing.first_name || ''} ${billing.last_name || ''}<br/>`;
}
if (billing.address1) billingAddressHtml += `${billing.address1}<br/>`;
if (billing.address2) billingAddressHtml += `${billing.address2}<br/>`;
if (billing.address1) {
billingAddressHtml += `${billing.address1}<br/>`;
}
if (billing.address2) {
billingAddressHtml += `${billing.address2}<br/>`;
}
if (billing.city || billing.province || billing.zip) {
billingAddressHtml += `${billing.city || ''} ${billing.province || ''} ${billing.zip || ''}<br/>`;
@ -99,14 +115,14 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
billingAddressHtml += `${billing.country}<br/>`;
}
// Show contact number
if (contactNumber) {
billingAddressHtml += `Contact: ${contactNumber}<br/>`;
// Show WhatsApp
if (whatsappNumber) {
billingAddressHtml += `<strong>WhatsApp:</strong> ${whatsappNumber}`;
}
// Show WhatsApp number separately
if (whatsappNumber) {
billingAddressHtml += `WhatsApp: ${whatsappNumber}`;
// Show Contact Number
if (contactNumber) {
billingAddressHtml += `<br/><strong>Contact Number:</strong> ${contactNumber}`;
}
const paymentMethod = orderData.gateway || 'Request Quote';