SureCart Integration
Create a SureCart customer and redirect the visitor to a prefilled SureCart checkout when a form is submitted.
Action type: surecart
Label: Create SureCart Checkout
Dependency: SureCart (available only when the SureCart\Models\Customer class exists)
Handler: Core_Forms\Integrations\IntegrationHandlers::surecart
Source: src/integrations/class-integration-manager.php, src/integrations/class-integration-handlers.php
Setup
- Make sure the SureCart plugin is installed and active. The action does not appear in the Actions list otherwise.
- In SureCart, open the product and copy the Price UUID of the price you want to sell.
- In WordPress, edit your form > Actions tab > Add Action > Create SureCart Checkout.
- Paste the Price UUID and adjust the contact field mappings if needed.
Settings Reference
| Setting | Required | Default | Description |
|---|---|---|---|
| Yes | [email] |
Customer email; must resolve to a valid address | |
| First name | No | [first_name] |
Customer first name |
| Last name | No | [last_name] |
Customer last name |
| Phone | No | [phone] |
Customer phone |
| Price UUID | Yes | -- | The SureCart price identifier to add to the checkout |
| Quantity | No | 1 |
Checkout line-item quantity (minimum 1) |
All text settings support Core Forms data variables, so the Price UUID can even come from a form field (e.g. [selected_plan]).
How It Works
- The action requires a valid email and a Price UUID; otherwise it fails with "SureCart email and Price ID are required."
- The customer is looked up in SureCart by email. If none exists, one is created with the submitted name fields.
- A checkout URL is built through SureCart's checkout API for the given price and quantity.
- The checkout URL is returned as the action's redirect, so the visitor is sent straight to SureCart checkout after the form succeeds.
- The action log also records a customer portal URL generated by the
cf_get_surecart_customer_portal_url()helper.
Each run is idempotent: Core Forms builds a key from the submission ID, action type, and resolved settings, so re-processing the same submission never creates a duplicate customer or checkout.
Customer Portal Helper
Core Forms ships a template helper for SureCart's customer portal:
cf_get_surecart_customer_portal_url( $customer_id );
Use it in your theme or a follow-up page to link customers to their SureCart dashboard. The action stores the generated portal_url in its result meta.
Troubleshooting
- Action missing from the Actions list: SureCart must be active; the availability check looks for the
SureCart\Models\Customerclass. - "SureCart email and Price ID are required": The email resolved to an empty/invalid value, or the Price UUID field is blank. Verify the data variable maps to a real form field.
- "SureCart checkout page is unavailable": SureCart could not produce a checkout URL. Confirm the SureCart checkout page exists and the Price UUID is valid.
- No redirect after submit: The redirect only applies when the action succeeds. Check the action log for the failure message.