User Role Select on Woocommerce Registration Stopped Working

前端 未结 1 554
你的背包
你的背包 2021-01-17 03:40

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

1条回答
  •  长情又很酷
    2021-01-17 04:02

    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');

    0 讨论(0)
提交回复
热议问题