WooCommerce is one of the most popular eCommerce platforms in the world, allowing online store owners to sell products and services effectively. However, it is often necessary to customize order confirmation emails to include specific information, such as customers’ CPF or CNPJ in Brazil.
Vor diesem Hintergrund erfahren Sie in diesem Sonderartikel von Nerd Codex, wie Sie CPF oder CNPJ in die WooCommerce-Bestell-E-Mail einfügen, um die Anforderungen Ihres Unternehmens zu erfüllen und die Informationen schneller und praktischer zu überprüfen.
Bevor Sie beginnen, stellen Sie sicher, dass Sie bei Ihrem WordPress-Administrationsbereich angemeldet sind, wo Sie Ihre WooCommerce-Site verwalten.
- Greifen Sie in der linken Seitenleiste Ihres WordPress auf die Option „Darstellung“ zu.
- Gehen Sie zur Option „Design bearbeiten“ oder verwenden Sie FTP/SFTP, um auf Ihr Design zuzugreifen.
- Öffnen Sie die Datei „functions.php“ und gehen Sie zur letzten Zeile, um neuen Code hinzuzufügen:
Funktion kia_display_email_order_user_meta( $order, $sent_to_admin, $plain_text ) {
if ($order->billing_cpf){
Echo '
CPF: '.$order->billing_cpf.'
';
}
if ($order->billing_cnpj){
Echo '
CNPJ: ‘. $order->billing_cnpj. ‘
';
}
}
add_action('woocommerce_email_customer_details', 'kia_display_email_order_user_meta', 30, 3 );
- Save the file and clear your site’s cache (if applicable) for immediate seeding;
- Warten Sie nun einfach auf eine neue Transaktion auf Ihrer Website oder geben Sie eine Testbestellung auf.
To ensure that the CPF or CNPJ is being displayed correctly in the order confirmation email, carry out a test purchase in your store. After completing your order, check the confirmation email you will receive. If everything is configured correctly, the confirmation email should display the customer’s CPF or CNPJ, as configured.
In summary, customizing the order confirmation email in WooCommerce to include the customer’s CPF or CNPJ is a relatively simple process, as long as you can enter the information into the functions.php. Wenn Sie die oben genannten Schritte befolgen, können Sie Ihren Kunden wichtige Informationen bereitstellen und das Einkaufserlebnis in Ihrem Online-Shop verbessern.
Foto von Cottonbro Studio