1.8 KiB
WPForms Integration Patterns
Various integration patterns for WPForms configurations, especially around feature-gated notifications and external data population.
Notification gating by payment processor
WPForms notifications have a paypal_commerce flag. When set to "1", the notification ONLY fires after PayPal confirms payment. For forms that offer "Pay Offline" as an option alongside PayPal, notifications configured with this flag will never trigger for offline payment submissions.
Detection: Check the notification settings JSON for "paypal_commerce": "1".
Fix: Remove the paypal_commerce key from the notification object via PHP:
unset($settings["settings"]["notifications"]["1"]["paypal_commerce"]);
$wpdb->update($wpdb->posts, ["post_content" => json_encode($settings)], ["ID" => $form_id]);
This appears to be set automatically when PayPal Commerce is configured — not exposed in the WPForms UI.
Custom JS populating a WPForms field
When a custom HTML widget (dropdowns, interactive elements) needs to submit data to WPForms:
- Add a Single Line Text field to the WPForms form, set CSS class
apex-vehicle-field - Update the JS to populate it on every selection change:
var wpf = document.querySelector('.apex-vehicle-field input, .apex-vehicle-field textarea');
if(wpf) wpf.value = year + ' ' + color + ' ' + make + ' ' + model + ' ' + hp;
Key: ensure hp is in scope — save the HP value before using it in the WPForms line. Common bug: declaring hp inside the spec-display block and trying to reuse it outside.
Google Sheets date format
WPForms Google Sheets provider config stores the date format in the form's JSON. Look for:
"G": "{entry_date format=\"d/m/Y\"}"
Change to "m/d/Y" for US format by editing the form's post_content in the database.