Get email attachments.
Obtenir des pièces jointes aux courriers électroniques.
array(
Sortie :
@return array
// Ajouter pièces jointes aux emails
add_filter('woocommerce_email_attachments', 'ajouter_pieces_jointes_email', 10, 3);
function ajouter_pieces_jointes_email($attachments, $email_id, $order) {
// Joindre CGV pour nouvelles commandes
if ($email_id === 'customer_processing_order') {
$cgv_path = get_template_directory() . '/documents/cgv.pdf';
if (file_exists($cgv_path)) {
$attachments[] = $cgv_path;
}
}
// Joindre facture pour commandes complétées
if ($email_id === 'customer_completed_order' && $order) {
$invoice_path = '/path/to/invoices/invoice-' . $order->get_id() . '.pdf';
if (file_exists($invoice_path)) {
$attachments[] = $invoice_path;
}
}
return $attachments;
}
Chargement des actualités...