Docs

MetForm Integration

3 min readUpdated June 21, 2026

MetForm is an Elementor-based WordPress form builder. Because MetForm forms are rendered by Elementor’s JavaScript engine rather than PHP templates, the WP Smart Consent integration uses a different injection approach compared to standard form plugins.

Enabling the Integration#

In the WP Smart Consent dashboard, go to Form Sources and toggle MetForm on. Per-form behavior is then configured individually from the MetForm form list.

Screenshot of a settings page for "MeForm" with "Inactive" status. The "Enable MetForm" toggle is off. A note gives setup instructions. Tabs include "General" and "Collect fields." At the bottom is a green "Save MetForm" button.

Per-Form Settings#

MetForm forms are Elementor widgets and their edit screen opens the Elementor editor, so a standard WordPress meta box cannot be added to the edit interface. Instead, WP Smart Consent adds a WP Smart Consent row action to the MetForm form list. Go to MetForm → Forms, hover over any form, and click WP Smart Consent in the row actions. This opens a dedicated settings page for that form stored in wp_options keyed by form ID. Settings are saved via AJAX.

Form Type#

Contact form — WP Smart Consent cannot inject a PHP-rendered checkbox into MetForm’s Elementor-rendered form markup. Instead, an inline script is emitted from wp_footer that uses a MutationObserver to detect when the form is rendered in the DOM, then injects a native checkbox element before the .mf-btn-wraper container.

MetForm’s JavaScript collects field values from its internal component state rather than from the raw form element before submitting via a fetch call to the MetForm REST endpoint (metform/v1/entries/insert/{form_id}). A native injected <input> would not be captured by that component state. WP Smart Consent therefore intercepts the fetch call before it is dispatched, reads the checkbox state from the DOM, and appends wpsc_optin=1 to the request body when the visitor has ticked the checkbox.

Newsletter form — no checkbox is injected. Every successful submission is treated as an opt-in and forwarded automatically.

Collect Fields#

Map the form’s fields to standard WPSC data fields. MetForm identifies each field by its mf_input_name slug — for example mf-email, mf-first-name-1, or mf-phone-1. These slugs appear as the keys in MetForm’s submitted $form_data array and are used directly for O(1) field value lookups. The dropdown in the settings page is populated automatically from the form’s registered fields.

Email — required. First name, Last name, Phone, Company, Country — all optional.

Extra Fields#

Below the standard field selectors, the Extra fields section lets you map any additional MetForm field to a custom CRM key. Select the form field on the left and enter the CRM key on the right. That key is sent alongside the standard contact data on every opt-in.

Submission Hook#

WP Smart Consent listens on metform_after_store_form_data, which fires after every successful MetForm submission and entry storage. The hook provides the $form_data array keyed by mf_input_name slug, enabling direct lookups by the field IDs configured in the per-form settings.

Troubleshooting#

Checkbox not appearing — MetForm injection relies on a MutationObserver watching for the form to be rendered into the DOM. If MetForm’s Elementor widget renders outside the standard flow or is embedded in a popup or tab that loads lazily, the observer may not detect it. Check the browser console for any JS errors on the page.

Consent value not captured on submit — the fetch intercept reads the checkbox state at submit time. If MetForm updates its submission mechanism in a future version, the intercept pattern may need updating. Check the WPSC Logs tab to confirm whether the opt-in event fired after submission.

WP Smart Consent row action not visible — confirm the MetForm integration is enabled in the WPSC dashboard. The row action is registered on the metform-form post type list at edit.php?post_type=metform-form.

Wrong field values forwarded — MetForm field slugs follow the pattern mf-{field-type}-{index} (e.g. mf-email, mf-first-name-1). If fields were re-ordered or re-added in the Elementor editor, their index suffix may have changed. Re-open the WP Smart Consent settings and re-select the correct fields.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only