Skip to main content

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

  1. Make sure Easy Digital Downloads is installed and active. The action does not appear in the Actions list otherwise.
  2. In WordPress, edit your form > Actions tab > Add Action > Create Easy Digital Downloads Order.
  3. Select the download and adjust the contact field mappings if needed.

Settings Reference

Setting Required Default Description
Email 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

  1. The action requires a valid customer email and a selected post of the download type; otherwise it fails with "A valid EDD product and customer email are required."
  2. An EDD_Customer is looked up by email. If none exists, one is created with the name built from first and last name.
  3. A pending order is created with the manual gateway, the store currency, and test/live mode matching edd_is_test_mode(). The total is the download price times the quantity.
  4. An order item for the download is added, and the order stores a _cf_submission_id meta with the submission ID.
  5. With Lead magnet discount enabled, a one-use percent discount is created: an active code starting with CF followed 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 download post.
  • "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.