Calculated Fields Form Blog

Tips and cases of use for a successful WordPress website with calculated forms.

Blog / Calculating download prices in the "Easy Digital Downloads" plugin at runtime

Calculating download prices in the "Easy Digital Downloads" plugin at runtime

There are different alternatives for selling digital products and service in WordPress, "Easy Digital Downloads" plugin is one of them. But selling services whose prices depend on many options could be complex (and sometimes impossible). The integration with the "Calculate Fields Form" plugin would solve this weakness.


For example, assuming you need to implement a service to book train tickets, this process can become really complex, because on the same train, the ticket price can depend on many factors: origin and destination, season, type of seat (tourist, business, sleeping car), special menu, additional luggage, travel insurance, and more.

The implementation of previous service with the "Easy Digital Downloads" plugin would be an Herculean work, but relatively simply with the "Calculated Fields Form" plugin.

Integrating both plugin would give you to the project the versatility of the "Calculated Fields Form" to estimate the products and services price, and the robustness of "Easy Digital Downloads" with its shopping cart, orders, customers management, data reporting, and more.

To allow the integration with the "Easy Digital Downloads" the Platinum version of "Calculated Fields Form" plugin includes the "CFF - Easy Digital Downloads" add-on, that allows insert the forms created with the "CFF" plugin into the downloads generated by the "EDD" plugin, and calculate their prices at runtime.

The integration between the plugins is described below:

The form (created with the CFF)

The form should be created with the "Calculated Fields Form" plugin as usual, with the required controls and equations to calculate the product or service price.

Some considerations:

  • The field that calculates the final price should be selected through the "Request Cost" attribute, in the form's settings:

Request Cost

  • The text of payment button in the download page, should entered into the "Submit button label (text)" attribute in the form's settings:

Button Text

  • If you need to use the price defined in the settings of download product (Easy Digital Downloads) for calculating the final price, the add-on generates the special variable: edd_cpcff_product_price

For example, if you need the duplicate the default price, the equation would be:

2*edd_cpcff_product_price
  • If you need to use the download's id through the form, maybe for reading some information from database using the DS fields, the add-on generates the special variable: edd_cpcff_product

Enabling the add-on

  • Go to the settings page of the plugin through the menu option: Calculated Fields Form
  • Tick the checkbox: CFF - Easy Digital Downloads
  • And press the Activate/Deactivate Addons button.

Activate the CFF - Easy Digital Downloads add-on

Creating the relationship between the form and the EDD download

Once the add-on is enabled will appears a new section in the download's settings, included by the add-on to complete the integration:

Realtionship between EDD and CFF

The integration should be configured as follows:

  • Select the form to integrate with the download through the attribute: "Enter the ID of the form"
  • Do you want estimate the download price at runtime? Tick the checkbox: "Calculate the product's price through the form"
  • If the payments below some threshold, enter the minimum price accepted into the attribute: "Minimum price allowed"

The information collected by the form is very valuable, the add-on includes a summary of this information in the shopping cart and orders. But, what to do if you want to exclude some fields from this summary (for example, auxiliary calculated fields)?

  • Tick the checkbox: "Activate the summary",
  • And enter into the "Summary" attribute, a combination of HTML tags and the special tags of fields to include in the shopping cart and orders.

Note: the fields' tags to include in the summary are the same used in the thank you pages and notification emails. Special Tags

Caveats

The form will be included only in the products pages, and not in the list of products inserted through the [downloads] and [edd_downloads] shortcodes.

It is not recommended the use of the add-on in products where is enabled variable pricing.

The form disables the AJAX submission.

After purchases the users will be redirected to the checkout page of "Easy Digital Downloads".

Every purchase will be added as a separated item in the shopping cart, disabling the quantity box.

The labels of purchase buttons are replaced by the text entered in the form settings.

More information in the following links:

https://cff.dwbooster.com/add-ons/edd

https://cff.dwbooster.com/documentation#edd-addon