Simple Custom Fields for WooCommerce Blocks Checkout FAQ

Support

1) How to request technical support?

If the issue you need technical support with is not covered on this page, click the link next to the license key, on the plugin settings, and fill out the ticket with your request.

2) Where do I report security vulnerabilities found in this plugin?

You can report any security bugs found in the source code of this plugin through the Patchstack Vulnerability Disclosure Program.

The Patchstack team will assist you with verification, CVE assignment and take care of notifying us.

Licensing

1) How to transfer the license to another domain?

You should ask for the domain change in your customer area, next to the original order details.

After you get the reply from us stating that the license key is free, you should go to the old website settings, remove the key and save. Then go to the new website settings, insert the same key and save. If you cloned the website, the license key is on the database, and you need to remove it, save, insert it again and save again.

General operation

1) Getting started guide

Install the plugin and go to WooCommerce > Checkout Blocks Custom Fields. Insert the provided license code to activate it.

Click “Add field” on the desired section, fill in the field label, slug (used to store the field on the order and user meta), and set other field options. Save it.

Your new field is now showing up on your block-based WooCommerce checkout.

You can edit or delete any field at any time. The previous order values will not be erased from the database, but you’ll not see them again on the order edit screen. That’s a limitation of the current API.

2) In which section should each field be placed?

Contact information fields (saved to the order and user for next orders): any personal fields that are related to the user but not to the address, for example:

  • VAT number
  • Birthdate
  • Passport number

Address fields (saved to the order and user for next orders): any fields that are related to the address but not the user (as they’re duplicated on both addresses), for example:

  • Contact person on address
  • Second phone number
  • Location hints

Additional information fields (saved only to the order and not to the user): any fields that are related to this specific order only, for example:

  • Delivery date
  • Include gift wrap
  • Message to include on package

3) Is it possible to add/remove/reorder WooCommerce Blocks core checkout fields?

Unfortunately no (or not yet). The API is evolving constantly and we are committed to include all the future possibilities on this plugin.

4) Can the custom fields be ordered and placed in between the core fields?

Contact information and Additional information fields can only be shown after the core fields, but you can set the order of your custom fields after that.

Address fields can be placed in 5 positions: before all the core fields, after the name fields, after the company field, after the country/address/city/postcode/state fields, and after all core fields. Inside each position you can set a second position for your custom fields, if you have more than one on each position.

5) What’s the “Pattern” option for?

That’s a way to limit the pattern/format of the inserted value on a text input by using regular expressions.

Here are some examples that might be useful:

  • Only numbers: ^[0-9]+$
  • Email address: [a-z0-9._%+\-]+@[a-z0-9.\-]+\.[a-z]{2,}$
  • URL (starts with http:// or https://): https?://.+
  • Eight or more characters: .{8,}

Advanced operation

1) How are the fields stored in the database, and how can I fetch them?

The fields are stored on orders and users meta on the on the _wc_other/swcbcf/field-slug, _wc_billing/swcbcf/field-slug and _wc_shipping/swcbcf/field-slug meta keys.

You can see the meta key for each field by editing it and click on “Show advanced options”:

You can should use our helper functions to get each field value, if you need to use them on your custom code. The PHP to be used for each field is also shown when you click on “Show advanced options”.

There are two helper functions:

swcbcf_get_order_field – To get order fields

Arguments:

  • $order_id – The order ID
  • $location – The location: ‘other’ (for contact or additional fields), ‘billing’ or ‘shipping’ (for address fields)
  • $field_slug – The field slug

swcbcf_get_user_field – To get user fields

Arguments:

  • $user_id – The user ID
  • $location – The location: ‘other’ (for contact fields), ‘billing’ or ‘shipping’ (for address fields)
  • $field_slug – The field slug

2) Is it possible to validate each field with custom PHP?

Since version 1.0, you can validate each field individually, but without having access to the other fields and values of the checkout, which means you still can’t do cross validation between several fields.

It might be possible to get those values by accessing the customer or order object, however this is not supported and there are no guarantees regarding backward compatibility in future versions.

For individual field validation you need to use our filter swcbcf_validate_callback_{location}_{field-slug} and return a string with the error description or nothing if the validation has passed, like in this example.

The complete filter name for each field is available on the field edit interface, under “developer info.”.