Public Ticket #3353071

New Customer Form Missing State

Closed
Comments
17 Tickets 5
Carl started the conversation 3 years ago on April 20, 2023 at 2:32pm

Hi,

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

2,762
KingsPlugins replied 3 years ago on April 21, 2023 at 11:07am

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://b2bkingplugin.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

17 Tickets 5
Carl replied 3 years ago on April 21, 2023 at 3:50pm

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,762
KingsPlugins replied 3 years ago on April 21, 2023 at 8:36pm

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.

2,762
KingsPlugins replied 3 years ago on April 24, 2023 at 4:49pm

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

17 Tickets 5
Carl replied 3 years ago on April 24, 2023 at 5:20pm

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

2,762
KingsPlugins replied 3 years ago on April 26, 2023 at 1:30pm

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

Sign In