Home › Toolset Professional Support › [Resolved] I created a form to create an user and fill in woo billing fields but it doesn't
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Our next available supporter will start replying to tickets in about 6.63 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
This topic contains 18 replies, has 2 voices.
Last updated by Minesh 5 months, 2 weeks ago.
Assisted by: Minesh.
Hi,
I created a form to register a new user. I need the woo billing fields to be filled in. So I created the billing fields. But there is no writing to it. Can you point out what I am doing wrong?
[creduserform]
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
[cred_field field='form_messages' class='alert alert-warning']
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="%%FORM_ID%%__billing_first_name">[cred_i18n name='_billing_first_name-label']Voornaam[/cred_i18n]</label> [cred_generic_field type='textfield' field='_billing_first_name'] { "required":1 } [/cred_generic_field]
</div>
<div class="col-md-6">
<label for="%%FORM_ID%%__billing_last_name">[cred_i18n name='_billing_last_name-label']Achternaam[/cred_i18n]</label> [cred_generic_field type='textfield' field='_billing_last_name'] { "required":1 } [/cred_generic_field]
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="%%FORM_ID%%__billing_address_1">[cred_i18n name='_billing_address_1-label']Straatnaam + nummer[/cred_i18n]</label> [cred_generic_field type='textfield' field='_billing_address_1'] { "required":1 } [/cred_generic_field]
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="%%FORM_ID%%__billing_postcode">[cred_i18n name='_billing_postcode-label']Postcode[/cred_i18n]</label> [cred_generic_field type='textfield' field='_billing_postcode'] { "required":1 } [/cred_generic_field]
</div>
<div class="col-md-6">
<label for="%%FORM_ID%%__billing_city">[cred_i18n name='_billing_city-label']Plaats[/cred_i18n]</label> [cred_generic_field type='textfield' field='_billing_city'] { "required":1 } [/cred_generic_field]
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="%%FORM_ID%%_user_email">[cred_i18n name='user_email-label']Email[/cred_i18n]</label> [cred_field field='user_email' class='form-control' output='bootstrap']
</div>
<div class="col-md-4">
<label for="%%FORM_ID%%__billing_phone">[cred_i18n name='_billing_phone-label']Telefoonnummer[/cred_i18n]</label> [cred_generic_field type='phone' field='_billing_phone'] { "required":1 } [/cred_generic_field]
</div>
<div class="form-group col-md-4">
<label for="%%FORM_ID%%_geboortedatum">[cred_i18n name='geboortedatum-label']Geboortedatum[/cred_i18n]</label> [cred_field field='geboortedatum' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_hoe-via-wie-bij-parre-en-deden-terecht-gekomen">[cred_i18n name='hoe-via-wie-bij-parre-en-deden-terecht-gekomen-label']Hoe/ via wie bij Parre en Deden terecht gekomen?[/cred_i18n]</label> [cred_field field='hoe-via-wie-bij-parre-en-deden-terecht-gekomen' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_akkoord-algemene-voorwaarden">
[cred_i18n name='akkoord-algemene-voorwaarden-label']Wij gaan zorgvuldig om met jouw persoonsgegevens. De wijze waarop wij dit doen lees je in de privacybeleid.[/cred_i18n]</label>
[cred_field field='akkoord-algemene-voorwaarden' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="col-md-12">
[cred_field field='recaptcha' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="col-md-12">
[cred_field field='form_submit' output='bootstrap' value='Submit' class='fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-2 fusion-button-default-span fusion-button-default-type']
</div>
</div>
</div>
[/creduserform]
Cheers
Marco
Hello. Thank you for contacting the Toolset support.
I see you are using the Generic field using which you are trying to save the WooCommerce billing field.
You can add the attribute to your generic field:
"persist":1
For example:
[cred_generic_field type='textfield' field='_billing_address_1'] { "required":1, "persist":1 } [/cred_generic_field]
Can you please try to add "persist":1 attribute where applicable and then save the form and then try to create new user and check if that help you to resolve your issue.
Hi Minesh,
That worked! Thanks. But now I don't get anything in the address part. I use _billing_address_1, do I need to use _billing_address?
Also I created a country field. This is not showing anything in the woocommerce billing country. What needs to be doen here?
I changed the fist and lastname fields for the account and this will take over in billing.
What do you suggest?
The new form is like this:
[creduserform]
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
[cred_field field='form_messages' class='alert alert-warning']
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="%%FORM_ID%%_first_name">[cred_i18n name='first_name-label']Voornaam[/cred_i18n]</label>
[cred_field field='first_name' class='form-control' output='bootstrap']
</div>
<div class="col-md-6">
<label for="%%FORM_ID%%_last_name">[cred_i18n name='last_name-label']Achternaam[/cred_i18n]</label>
[cred_field field='last_name' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="col-md-12">
<label for="%%FORM_ID%%_billing_address">[cred_i18n name='billing_address-label']Straatnaam + nummer[/cred_i18n]</label> [cred_generic_field type='textfield' field='billing_address'] { "required":1, "persist":1 } [/cred_generic_field]
</div>
</div>
<div class="row">
<div class="col-md-6">
<label for="%%FORM_ID%%_billing_postcode">[cred_i18n name='billing_postcode-label']Postcode[/cred_i18n]</label> [cred_generic_field type='textfield' field='billing_postcode'] { "required":1, "persist":1 } [/cred_generic_field]
</div>
<div class="col-md-6">
<label for="%%FORM_ID%%_billing_city">[cred_i18n name='billing_city-label']Plaats[/cred_i18n]</label> [cred_generic_field type='textfield' field='billing_city'] { "required":1, "persist":1 } [/cred_generic_field]
</div>
</div>
<div class="col-md-12">
<div class="row">
<label for="%%FORM_ID%%_billing_country">[cred_i18n name='billing_country-label']Land[/cred_i18n]</label>
[cred_generic_field type='select' field='billing_country']
{
"required":0,"persist":1,
"default":["Nederland"],
"options":[{"value":"Nederland","label":"Nederland"},{"value":"België","label":"België"},{"value":"Duitsland","label":"Duitsland"}]
}
[/cred_generic_field]
</div>
</div>
<div class="row">
<div class="form-group col-md-4">
<label for="%%FORM_ID%%_user_email">[cred_i18n name='user_email-label']Email[/cred_i18n]</label> [cred_field field='user_email' class='form-control' output='bootstrap']
</div>
<div class="col-md-4">
<label for="%%FORM_ID%%_billing_phone">[cred_i18n name='billing_phone-label']Telefoonnummer[/cred_i18n]</label> [cred_generic_field type='phone' field='billing_phone'] { "required":1, "persist":1 } [/cred_generic_field]
</div>
<div class="form-group col-md-4">
<label for="%%FORM_ID%%_geboortedatum">[cred_i18n name='geboortedatum-label']Geboortedatum[/cred_i18n]</label> [cred_field field='geboortedatum' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_hoe-via-wie-bij-parre-en-deden-terecht-gekomen">[cred_i18n name='hoe-via-wie-bij-parre-en-deden-terecht-gekomen-label']Hoe/ via wie bij Parre en Deden terecht gekomen?[/cred_i18n]</label> [cred_field field='hoe-via-wie-bij-parre-en-deden-terecht-gekomen' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_akkoord-algemene-voorwaarden">
[cred_i18n name='akkoord-algemene-voorwaarden-label']Wij gaan zorgvuldig om met jouw persoonsgegevens. De wijze waarop wij dit doen lees je in de privacybeleid.[/cred_i18n]</label>
[cred_field field='akkoord-algemene-voorwaarden' force_type='field' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="col-md-12">
[cred_field field='recaptcha' class='form-control' output='bootstrap']
</div>
</div>
<div class="row">
<div class="col-md-12">
[cred_field field='form_submit' output='bootstrap' value='Submit' class='fusion-button button-flat fusion-button-default-size button-default fusion-button-default button-2 fusion-button-default-span fusion-button-default-type']
</div>
</div>
</div>
[/creduserform]
As I can see with the following doc:
- hidden link
I do not see field like "_billing_address" - if you check the above doc at bottom of the page you will see all the available fields and fields for billing are:
billing_first_name
billing_last_name
billing_company
billing_address_1
billing_address_2
billing_city
billing_postcode
billing_country
billing_state
billing_email
billing_phone
Can you adjust the field slug accordingly and prefix with underscore (_) if required.
Hi Minesh,
Thanks for your support so far 🙂
I changed it to:
<label for="%%FORM_ID%%__billing_address_1">[cred_i18n name='_billing_address_1-label']Straatnaam + nummer[/cred_i18n]</label>
[cred_generic_field type='textfield' field='_billing_address_1']
{
"required":1,
"default":"",
"persist":1
}
[/cred_generic_field]
No luck here. Why is this not working like the postcode and city? Do I need to add the second address fields too? Is this mandatory?
And how about the country part? What must I do here? This can't be this difficult?
Aaaahh it is frustrating 🙂
I'm not sure until I check your setup.
Can you please share problem URL where you added the forms and steps I need to follow the see the issue as well as information about with what fields you have issues with.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Have you changed the password as the shared admin access details is not working at this end.
Can you please send me working admin access details.
I have set the next reply to private which means only you and I have access to it.
So sorry Minesh, here are the right login creds hidden link
I see you are using third-party plugin to manage the checkout fields "Checkout Field Editor for WooCommerce (Pro)".
Toolset Forms offers a feature that you can manage third-party plugins fields while using Toolset forms. What if you try to navigate to:
=> Toolset => User Forms => click on the button "Manage non-Toolset User Fields" and try to add the fields you want.
As you can see I've added the field "billing_country" to manage with Toolset User forms and the field type will be select and added those options.
- hidden link
As you can see how the field is added to the form now:
<div class="form-group"> <label for="%%FORM_ID%%_billing_country">[cred_i18n name='billing_country-label']billing_country[/cred_i18n]</label> [cred_field field='billing_country' force_type='field' class='form-control' output='bootstrap'] </div>
Added the form to the following test page:
- hidden link
I can see the dropdown for the billing country. Can you please try to check and create a new form with minimum required fields and try to add couple of billing fields to it once you set it to manage with Toolset Forms from: Toolset => User Forms => button "Manage non-Toolset User Fields"
and check if that help you to resolve this issue.
More info:
- https://toolset.com/course-lesson/letting-toolset-edit-custom-fields-created-by-other-plugins/
Hi Minesh,
I have added your code in the form "Client gegevens":
<div class="form-group">
<label for="%%FORM_ID%%_billing_country">[cred_i18n name='billing_country-label']billing_country[/cred_i18n]</label>
[cred_field field='billing_country' force_type='field' class='form-control' output='bootstrap']
</div>
But it is still not writing to the billing country.
DO I need to add the { "required":1, "persist":1 } too? Where does this go? Or must I use the underscore in front?
I know we are close 🙂
Ok - I found that billing country requires country code.
As you can see now I've updated the option values with country code.
- hidden link
Can you please check now. There is no need to add underscore as the billing country field slug is correct.
Can you please try to load user form on frontend and check the country names values are country code now as I setup with above link and try to check if that works now.
If that does not work then the last option would be to use "cred_save_data" hook and we can setup the country code like this:
$country_code = 'US'; // Get the WC_Customer instance object from user ID $customer = new WC_Customer( $user_id ); $customer->set_billing_country( $country_code ); $customer->set_shipping_country( $country_code ); $customer->save();
This worked now!!! But now the billing_address_1. This is my code:
<div class="form-group">
<label for="%%FORM_ID%%_billing_address_1">[cred_i18n name='billing_address_1-label']Straatnaam + huisnummer[/cred_i18n]</label>
[cred_field field='billing_address_1' force_type='field' class='form-control' output='bootstrap']
</div>
It is not picking up the address in the user billing fields. WHat can be going wrong?
Marco
Have you try to add the billing_address_1" field again and remove the existing one from your form.
Can you please try to re-add the billing_address_1 field that you added from "Manage non-Toolset User Fields with Toolset Forms":
- hidden link
OR
Does it works with:
[cred_generic_field type='textfield' field='_billing_address_1'] { "required":1,"persist":1} [/cred_generic_field]
Hi Minesh,
You are telling it like I can add the fields from Manage non-Toolset User Fields to a form thru the form? Is this thru. I can't find how? I can't find them in the custom fields or in the user forms add fields. What are the steps to add these non-toolset user fields? In the user form I have :
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="%%FORM_ID%%_billing_address_1">[cred_i18n name='billing_address_1-label']Straatnaam + huisnummer[/cred_i18n]</label>
[cred_generic_field type='textfield' field='_billing_address_1'] { "required":1,"persist":1} [/cred_generic_field]
</div>
</div>
</div>
It is not working unfortunately.
Why do I have to delete the fields before adding them again. Is this cache or something? I want to understand.
Thanks again
I'm not sure what form you are using now for testing.
I see you added billing fields to section ""Manage non-Toolset User Fields with Toolset Forms":"
=> hidden link
Would you mind to create brand new form and make sure all those fields are added to this new form and adjust your form fields as required and remove the fields not required and then test.