Skip Navigation

[Resolved] Checkout Woocommerce CRED Form

This thread is resolved. Here is a description of the problem and solution.

Problem: I have added all the WooCommerce billing fields to Types control, and I would like to use CRED to capture that information when a new User is created. I am unable to use a select type field for country and state.

Solution: It's not currently possible to modify the field type when you move a field into Types control. You would be required to use the correct two-letter abbreviations for Country and State as defined by WooCommerce. If you want to create custom select fields, you can use the cred_save_data hook to capture the selected values and store them in the billing fields.

Relevant Documentation: http://creatingawebstore.com/woocommerce-country-codes-and-state-codes-list.html
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by andreaD-4 6 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#573049
Schermata 2017-09-24 alle 18.28.29.png

hi Christian,
I've created a CRED form to register users and a section for Billing. but the fields billing_country and billing_state I can not turn them into Select. I do not understand how to enter values ​​that after registering the CRED form remain in the Customer billing address section. can you help me?
thank you.

#573081

Hi, you must use the same two-character codes for country and state that are used by standard WooCommerce billing fields. Here's a reference:
hidden link

#573143
Schermata 2017-09-25 alle 07.14.21.png
Schermata 2017-09-25 alle 07.13.43.png

Thanks for your help.
I can not change the type of field (billing_country) in Select. When I try to modify it from Form User there is no save.
In the original form of woocommerce I think it is conditional because when I choose italy in billing_state i look all the provinces of italy . How can I get this feature if I can not change Single Line in Select?

#573388

As I mentioned in the previous ticket, these fields must be string fields instead of selects:
https://toolset.com/forums/topic/user-registration-in-woocommerce/#post-571526
Billing Country and Billing State will be converted to text fields instead of select fields, so you will be required to know the two-letter abbreviations for all countries and states.

You cannot use a select field for country or state.

#573983

ok, so I can create a new field with select select IT value and copy it to the hidden field billing_country by php code. This is fine?

#574153

ok, so I can create a new field with select select IT value and copy it to the hidden field billing_country by php code. This is fine?
If you want to write custom PHP to save this value using a custom select field, you can use the cred_save_data hook. More information about this hook here:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Most of the documentation is written for posts, but the syntax is identical for users.

#575116

Thank you Christian

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.