Okay
  Public Ticket #3353071
New Customer Form Missing State
Closed

Comments

  •  5
    Carl started the conversation

    Hi,

    The form that the sales agent uses to create a new customer is missing State even though the default is enabled. 

    Attached files:  B2B King Agent New Customer Form.jpg
      B2B King Enabled Field List.jpg

  •  2,218
    WebWizards replied

    Hi Carl,


    You could add the state there by adding the following PHP code snippet to your site:


    add_action('salesking_add_customer_after_country',function(){
        ?>
        <div class="form-group">
            <label class="form-label" for="billing_country"><?php esc_html_e('State','salesking'); ?></label>
            <div class="form-control-wrap">
                <input type="text" class="form-control" id="billing_state" name="billing_state">
            </div>
        </div>
        <?php
    });
    


    A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/

    You will then see State as a text field there:

    4779470774.png


    I don't have a way to make that an automatic dropdown at the moment,


    Kind regards,

    Stefan

  •  5
    Carl replied

    I am getting the following error message. I am trying to create a test user that does not exist. 


    The customer account could not be created. It may be because the username or email already exists. Here are the error details: error<strong>State / County</strong> is not valid. Please enter one of the following: Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, District Of Columbia, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming, Armed Forces (AA), Armed Forces (AE), Armed Forces (AP)success

  •  2,218
    WebWizards replied

    When using a text box there, the agent would need to enter the 2-letter code of the state, such as AL, CA, CO etc.

    If your site serves exclusively the USA, you could also configure is so that instead of an <input type="text"> field, you have a <select> </select> field with all options for all US states configured separately.

  •  5
    Carl replied

    Hi,

    The state issue seems to be fixed, but I am getting the attached error saying that the customer cannot be created. 

    Thanks.

    Attached files:  B2B Customer Cannot Be Created.jpg
      User Does Not Exist.jpg

  •  2,218
    WebWizards replied

    Hi,

    In your example, the issue is you are trying to create a user with the username carl.right

    This username does already exist:

    1268329933.png


    In the screenshot you are checking that the email carl4 does not exist, but the error is about the username, not the email.


    Kind regards,

    Stefan

  •  5
    Carl replied

    I am attaching screenshots of the registration fields I am using. Also, now I seem to be getting this error message again.

    The customer account could not be created. It may be because the username or email already exists. Here are the error details: error<strong>State / County</strong> is not valid. Please enter one of the following: Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware, District Of Columbia, Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana, Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia, Wisconsin, Wyoming, Armed Forces (AA), Armed Forces (AE), Armed Forces (AP)success

    Attached files:  B2B Registration 1.jpg
      B2B Registration 2.jpg

  •  2,218
    WebWizards replied

    Hi,

    I tried creating a customer locally setting the state to "IL": https://prnt.sc/splCjfYHO7XU

    This works normally for me and there is no error as in your example. In fact it works in my tests, no matter what is entered under the state field.


    I believe there is probably some kind of plugin conflict with this feature - possibly one of the plugins affecting registration has some specific state requirements and is throwing that error.

    I would advise trying to deactivate all other site plugins and switch to the default Storefront theme to help you identify where this requirement is coming from,


    Kind regards,

    Stefan

  •  5
    Carl replied

    We found the plugin causing the problem was called WooCommerce B2B -- unrelated and not used. Thanks.