I use a drop down menu to select between two user roles on my Woocommerce registration form. After updating to Woocommerce 3.0.8 the drop down menu stopped working and I can
I decided to scrap the old code and replaced it with the following code and it works now.
/* To add WooCommerce registration form custom fields. */
function WC_extra_registation_fields() {?>
add('role_error', __('Dealer or Distributor is required!', 'woocommerce'));
}
return $validation_errors;
}
add_action('woocommerce_register_post', 'WC_validate_reg_form_fields', 10, 3);
/* To save WooCommerce registration form custom fields. */
function WC_save_registration_form_fields($customer_id) {
//Role field
if (isset($_POST['role'])) {
update_user_meta($customer_id, 'role', sanitize_text_field($_POST['role']));
}
}
add_action('woocommerce_created_customer', 'WC_save_registration_form_fields');