Skip to content
Docs
Get RestroPress

Checkout Fields Manager

Updated 7 min read
On this page

Checkout Fields Manager lets you add your own fields to the RestroPress checkout, for example a company name, a delivery note, a date, a file upload or a consent checkbox. You build the form in the admin with a drag-and-drop builder. The answers are saved with the order (or with the customer's user account) and can be shown in the order screen, receipt, emails and exports.

Requirements#

  • RestroPress, installed and active. If it is not active the plugin shows an error notice and deactivates itself. No minimum RestroPress version is checked in code; version 1.0.6 of the extension is marked as compatible with the RestroPress 3.4 checkout layout.
  • The readme lists WordPress 5.0 and PHP 5.4 as minimums and WordPress 7.1 as the version it was tested up to.

Installation#

  1. In Plugins › Add New › Upload Plugin, choose the ZIP file and select Install Now.
  2. Select Activate. On activation a "Checkout Fields" form is created automatically.
  3. A Checkout Form item appears under the RestroPress menu. This is the form builder.

This plugin has no licence key field and no update checker of its own.

Settings#

Two settings are in RestroPress › Settings › General › Checkout Fields Manager.

SettingWhat it doesDefault
Show submitted information on Purchase Confirmation?Shows the submitted field values on the purchase confirmation page, and enables the {checkout_form} email tag content.Off
Purchase Confirmation Header TextHeading shown above the values on the confirmation page.Information

Building the form#

Open RestroPress › Checkout Form. The page has a Form Editor box, a Save box and an Add Custom Fields box with one button per field type. Click a button to add a field, drag fields by their title bar to reorder them, use Toggle to open a field and Remove to delete it, then click Save.

The Checkout Form builder with a custom field open

There are 14 field types: Checkbox, Date, Email, File Upload, Hidden, HTML, Multiselect, Radio, Repeat, Section Break, Select, Text, Textarea and URL.

Options common to fields#

OptionWhat it does
Field location on checkout pagePersonal info section (default) or Order details section.
Show field on frontend checkout field"Show this in both the frontend and admin" (default), or "Show this field only in the admin", for data only staff fill in.
Show in exported CSVsInclude or exclude the field in CSV exports.
Where should this meta be storedPayment Meta (a value per order) or User Meta (one value per customer). The builder warns not to change this once set.
RequiredYes or No. Required fields show an asterisk and are checked at checkout.
Field LabelThe label shown to the customer.
Meta KeyThe key the value is saved under. Special characters are removed.
Help textShown on the checkout only.
CSS Class NameExtra class on the field wrapper.
Placeholder text, Default value, SizeAvailable on text-style fields.
Show field in Privacy ExportWhether the value is included in a customer's personal data export.
Erase Private Data ActionNo Action, Anonymize or Delete when a personal data erasure is run.

The privacy options only affect fields stored as payment meta.

Options specific to a field type#

  • Textarea: Rows, Columns, and the editor type (Normal, Rich textarea, Teeny Rich textarea).
  • Select and Multiselect: Options list and Select Text.
  • Radio and Checkbox: Options list.
  • Date: Enable time input, and Start View (Day, Month or Year).
  • File Upload: Max. file size (in KB), Max. files, and Allowed Files (file groups such as images, audio, video, PDF, office documents, zip archives, CSV).
  • Repeat: Multiple Column, Columns, and Add another choice for adding more repeated inputs.
  • HTML (Title and HTML content) and Section Break (Title and Description): display-only; they are not shown on the receipt.
  • Hidden: Meta Key and Meta Value; not shown on the receipt.

Tools#

The tab at RestroPress › Tools › Checkout Fields Manager offers:

  • Reset Checkout Form: deletes the form and recreates it with the default fields.
  • Export Checkout Fields: downloads the field definitions as a .json file.
  • Import Checkout Fields: replaces the field definitions from a .json file exported on another site.

How it works#

Customer side#

  1. At checkout, fields set to "Personal info" appear in the personal information section and fields set to "Order details" appear in the order details section. Admin-only fields are not shown.
  2. When the customer places the order, required fields are validated. Messages include "Please fill out the %s field.", "Please enter a valid email address in %s." and "Please select at least 1 option for %s." and block the order until fixed.
  3. After the order is created, the values are saved: as order meta for Payment Meta fields or as user meta for User Meta fields.
  4. If Show submitted information on Purchase Confirmation? is on, the values appear on the confirmation page under the header text.
  5. Logged-in customers can see User Meta fields in the profile editor shortcode, where they can update them.

Restaurant side#

  • In the order details screen a "Custom Fields" box is shown; staff can edit the values, including admin-only fields, and they save with the order.
  • Emails: a value can be inserted by writing {meta_key} in the email template (purchase receipt and sale notification), and the {checkout_form} tag outputs all values when the confirmation-page setting is on.
  • Payment CSV export and the personal data export/erase tools include fields according to their per-field options.

Developer reference#

The plugin fires about 150 hooks, many built from the form name (checkout) or field template. The most useful ones are below.

HookTypeParametersPurpose
cfm_render_checkout_form_frontend_fieldsfilter$fields, $form, $current_user_id, $profileChange the field objects shown at checkout.
cfm_templates_to_exclude_render_checkout_form_frontendfilter$templates, $profileHide whole field types from the checkout.
cfm_render_checkout_form_frontend_fields_before_field, ..._after_fieldfilter'', $field, $form, $current_user_id, $profileAdd HTML before or after each field.
cfm_render_checkout_form_frontend_before_fields, ..._after_fieldsaction$form, $current_user_id, $profileRun code around the field list.
cfm_save_checkout_form_frontend_valuesfilter$values, $form, $payment_id, $user_idChange submitted values before they are sanitised and saved.
cfm_save_checkout_form_frontend_values_after_saveaction$values, $form, $current_user_id, $payment_id, $user_idRun code after the checkout values are saved.
cfm_save_checkout_form_values_after_saveaction$form, $current_user_id, $payment_id, $user_idRun code after a save from the front end or the admin.
cfm_save_field_before_save_frontend, cfm_save_field_after_save_frontendaction$field, $payment_id, $user_id, $value, $current_user_idRun code around saving a single field.
cfm_save_field_before_save_admin, cfm_save_field_after_save_adminactionsame as aboveSame, for saves from the order screen.
cfm_sanitize_{template}_field (for example cfm_sanitize_text_field)filter$values, $name, $payment_id, $user_idSanitise or validate a field type. Add an error with rpress_set_error().
cfm_{field_name}_field_requiredfilter$required, $fieldMake one field required or optional in code.
cfm_get_field_value_return_value_frontend, ..._adminfilter$value, $field, $payment_id, $user_idChange a stored value as it is read.
cfm_receipt_show_fieldfilter$show, $fieldControl whether a field is listed on the confirmation page.
cfm_required_mark, cfm_required_html5, cfm_required_classfiltermarkup stringChange the required indicator, attribute and class.
cfm_allowed_html_tagsfilter$tagsTags allowed in HTML-type content.
cfm_forms_options_frontendfilter$optionsChange the data passed to the checkout script (cfm_form).
cfm_checkout_form_titlefilter$titleRename the form in the menu.

Values are stored with update_post_meta() on the order (Payment Meta) or update_user_meta() (User Meta), under the field's Meta Key. Read one with get_post_meta( $order_id, 'your_key', true ). The checkout form's post ID is in the option cfm-checkout-form.

// Make sure a "delivery_note" field is at most 200 characters
add_filter( 'cfm_sanitize_textarea_field', function ( $values, $name ) {
    if ( 'delivery_note' === $name && ! empty( $values[ $name ] ) ) {
        $values[ $name ] = substr( $values[ $name ], 0, 200 );
    }
    return $values;
}, 10, 2 );

Troubleshooting#

  • Admin warning that the checkout form isn't set. Go to RestroPress › Tools › Checkout Fields Manager and use Reset Checkout Form. This removes your custom fields, so export them first if you have any.
  • Fields do not appear on the checkout. Check the field is not set to admin only and that its location (Personal info or Order details) exists in your checkout layout. Custom checkout templates must still call the standard RestroPress checkout hooks.
  • Confirmation page shows no values. Turn on Show submitted information on Purchase Confirmation?. Hidden, HTML and Section Break fields are never listed.
  • Values not in the CSV export. The field's "Show in exported CSVs" option must be set to show.
  • A value is not saved. Required fields stop the order with an error; check the message at the top of the checkout.
  • Layout broken after an update. Version 1.0.6 fixed checkout layout problems on RestroPress 3.4. Update to the latest version.

Changelog highlights#

  • 1.0.6: fixed checkout layout breakage, premature closing tags on checkout and receipt, and compatibility with the RestroPress 3.4 two-column checkout; disabled the unused Upgrades submenu.
  • 1.0.5: removed warnings and deprecated notices; code clean-up.
  • 1.0.4: fixed required plugin validation issue.
Was this page helpful?