mail number fixed

This commit is contained in:
Selvi 2026-06-22 19:40:00 +05:30
parent 000b1ce970
commit 8017040708

View File

@ -74,55 +74,27 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
// --- 3. Billing Address Details HTML ---
const billing = orderData.billing_address || {};
// 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.note_attributes?.find?.(
(attr) => attr.name === 'Whatsapp Number'
)?.value ||
orderData.attributes?.['Whatsapp Number'] ||
billing.phone ||
orderData.phone;
const contactNumber = orderData.note_attributes?.find?.((attr) => attr.name === 'Contact Number')?.value
|| orderData.attributes?.['Contact Number']?.contact_phone
|| orderData.attributes?.['Contact Number']
|| orderData.contact_phone
|| orderData.attributes?.contact_phone;
let billingAddressHtml = '';
if (billing.first_name || billing.last_name) {
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/>`;
}
if (billing.country) {
billingAddressHtml += `${billing.country}<br/>`;
if (billing.country) billingAddressHtml += `${billing.country}<br/>`;
if (billing.phone || orderData.phone) {
billingAddressHtml += `${billing.phone || orderData.phone}`;
}
// Show WhatsApp
if (whatsappNumber) {
billingAddressHtml += `<strong>WhatsApp:</strong> ${whatsappNumber}`;
}
// Show Contact Number
if (contactNumber) {
billingAddressHtml += `<br/><strong>Contact Number:</strong> ${contactNumber}`;
billingAddressHtml += `<br/>Contact: ${contactNumber}`;
}
const paymentMethod = orderData.gateway || 'Request Quote';