• Resolved joel

    (@joel2019)


    Hi,
    I found this code on your website

    /**
     * Add a custom field (in an order) to the emails
     */
    add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 );
    
    function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
        $fields['hear_about_us'] = array(
            'label' => __( 'Hear About Us' ),
            'value' => get_post_meta( $order->id, 'hear_about_us', true ),
        );
        return $fields;
    }

    But it add’s only a field to a new order mail. I want to add a field to the new account email.

    Can someone help?

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mirko P.

    (@rainfallnixfig)

    Hi @joel2019,

    You could modify your New account email using this template:

    customer-new-account.php

    To override and edit this email template copy woocommerce/templates/emails/customer-new-account.php to your theme folder: [Your child theme]/woocommerce/emails/customer-new-account.php.

    Read more about how to override and customize templates in WooCommerce by starting here:

    https://docs.woocommerce.com/document/template-structure/

    Hope this helps.

    Thread Starter joel

    (@joel2019)

    Hi Mirko,

    Thankyou, but I don’t know how to get the data of the custom field on de registration form. I made a field for billing_company and billing_postcode. Do you know how I can get the values that are filled in?

    Thanks

    Nikki

    Mirko P.

    (@rainfallnixfig)

    Hi @joel2019,

    This is not something that can be done with the default options in WooCommerce. You’d need to add a bit of additional custom code to achieve that.

    If you do require more help with the actual coding, we’d recommend hiring a developer or one of the customization experts listed at https://woocommerce.com/customizations/.

    Alternatively, I believe the Custom User Registration Fields for WooCommerce extension can do the job for you. For pre-sales questions, contact us at: https://woocommerce.com/contact-us/#sales-form.

    Just so you know, we offer a 30-day refund policy so you can test out the extension with your requirements and make sure it works for you. Here are more details on the refund policy: https://woocommerce.com/refund-policy/.

    Cheers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add field to new account email’ is closed to new replies.