Custom Email Field Not Appearing in Checkout
-
I’m trying to add additional email fields to the checkout page. I’ve followed the process listed on the “Customizing checkout fields using actions and filters” page on the WooCommerce website, however the custom field will not display. We’re using the checkout blocks as our checkout page. The code I’m using is below:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['billing']['additional_email'] = array( 'label' => __('Email', 'woocommerce'), 'placeholder' => _x('Email', 'placeholder', 'woocommerce'), 'required' => false, 'class' => array('form-row-wide'), 'clear' => true ); return $fields; } add_action('woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 ); function my_custom_checkout_field_display_admin_order_meta($order){ echo '<p><strong>'.__('Additional Participant Email').':</strong> ' . get_post_meta( $order->get_id(), '_additional_email', true ) . '</p>'; }
Ideally, the additional email field would appear in the “Contact Information” section. We’re selling classes with our WooCommerce store, so these additional email fields will be used to send confirmation to all of the participants who will be taking the class.
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Custom Email Field Not Appearing in Checkout’ is closed to new replies.