Easy Digital Downloads Integration
Create an Easy Digital Downloads customer and a pending order when a form is submitted, with an optional one-use discount code for lead magnets.
Action type: edd
Label: Create Easy Digital Downloads Order
Dependency: Easy Digital Downloads (available only when edd_add_order() exists; EDD 3.x order API)
Handler: Core_Forms\Integrations\IntegrationHandlers::edd
Source: src/integrations/class-integration-manager.php, src/integrations/class-integration-handlers.php
Setup
- Make sure Easy Digital Downloads is installed and active. The action does not appear in the Actions list otherwise.
- In WordPress, edit your form > Actions tab > Add Action > Create Easy Digital Downloads Order.
- Select the download 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 |
| Download | Yes | -- | EDD download to add to the order |
| Quantity | No | 1 |
Order-item quantity (minimum 1) |
| Lead magnet discount | No | Off | Generate a one-use discount code per submission |
| Discount percent | No | 10 |
Percent value for the generated discount (clamped to 1--100) |
All text settings support Core Forms data variables such as [email] or any form field name.
How It Works
- The action requires a valid customer email and a selected post of the
downloadtype; otherwise it fails with "A valid EDD product and customer email are required." - An
EDD_Customeris looked up by email. If none exists, one is created with the name built from first and last name. - A pending order is created with the
manualgateway, the store currency, and test/live mode matchingedd_is_test_mode(). The total is the download price times the quantity. - An order item for the download is added, and the order stores a
_cf_submission_idmeta with the submission ID. - With Lead magnet discount enabled, a one-use percent discount is created: an active code starting with
CFfollowed by 8 random characters,max_uses = 1, named "Core Forms lead {submission ID}."
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 order or discount.
Notes
- The generated discount code is visible under Downloads > Discounts in wp-admin and in the action log meta (
discount_id). The action does not email the code; add it to a follow-up email action if you want to send it. - The order is left pending. Complete it manually or through your own follow-up workflow.
Troubleshooting
- Action missing from the Actions list: Easy Digital Downloads must be active, and the site must run EDD 3.x (the action uses
edd_add_order()). - "A valid EDD product and customer email are required": The email field resolved to an empty/invalid address, or the selected item is not a
downloadpost. - "EDD could not create the pending order": EDD rejected the order insert; check the EDD debug log.
- No discount created: The checkbox must be enabled and
edd_add_discount()must exist.