Gravity Forms eCommerce Fields

Make Gravity Forms more eCommerce-friendly with support for Tax, Discounts, and Subtotal fields plus a bunch of other helpful eCommerce features.

What does it do?

With the GF eCommerce Fields plugin you can easily add eCommerce field types to your Gravity Forms. The new pricing fields include Discount, Tax, and Subtotal. This plugin also improves upon the functionality of Gravity Forms’ Coupons and Shipping fields.

GF eCommerce also adds support for special merge tags for including the subtotal, coupon and discount amounts in calculation-enabled fields along with a handy merge tag for displaying the order summary in your confirmations and notifications.

gp-ecommerce-fields-featured

Features

  • New pricing fields.
    New Discount, Tax, and Subtotal fields allow you to create advanced eCommerce forms.
  • Adjustable taxes.
    New Tax field calculates and applies percentage discount based on the total or a specific products.
  • Flexible discounts.
    New Discount field applies flat or percentage discount to the total or specific products. Use conditional logic to only apply the discount when certain conditions are met.
  • Helpful subtotals.
    Help your users better understand their orders; show the subtotal before shipping, coupons and taxes have been applied.
  • Tight integration with existing Gravity Forms fields.
    The Coupons and Shipping fields have been improved to better integrate with Subtotals, Discounts and Taxes.
  • Calculation-ready merge tags.
    Make custom calculations based on the subtotal or coupon and discount amounts with Gravity Forms’ calculation feature and GF eCommerce merge tags.
  • Improved order summary.
    We’ve completely revamped the order summary to support the new pricing fields and make it even easier to digest.
  • Seamless, easy-to-use UI.
    Integrates directly with the Gravity Forms toolbar. A single click activates the preview.
  • Automatic updates.
    Get updates and latest features right in your dashboard.
  • Awesome support.
    We’re here to help! And we mean it.

How do I enable this functionality?

This document assumes you know how to create a form. For information on creating a form, visit Creating a form.

Fields described in this document can be found under Pricing Fields. Pricing Fields allow you to add fields to your form to calculate pricing for selling goods and services.


Feature Details

Fields

Tax Field

The Tax Field allows you to add a preconfigured tax to the form. End users can view the Field Label, the amount to be paid, and the Description.

The Tax Field supports percentage values only. You can apply the tax to all products, specific products or all products except one(s) selected. You can add multiple Tax Fields to the form.

The tax influences the Total amount. The tax is not included in the Subtotal and Discount amounts.

Usage Examples
Subtotal Field

The Subtotal Field is used to display the sum of the line item total prices in the form. As the user selects products and options, the subtotal automatically updates. End users can view the Field Label, the subtotal amount, and the Description.

Subtotal does not include tax and discounts. You can select if to calculate subtotal values for all listed products, specific products or to exclude the selected products. You can add multiple Subtotal Fields to the form.

You can add a subtotal for a group of products.

Discount Field

The Discount Field allows you to add a preconfigured discount to the form. End users can view the Field Label, the amount to be discounted, and the Description.

The amount to be discounted can be a flat rate adjustment or a percentage of the price of the product. You can apply the discount to the form total, specific products or apply to all products except one(s) selected. You can add multiple Discount Fields to the form.

Usage Examples
Coupon Field

Coupons are price reductions. The Coupon Field is available when you use the Gravity Forms Coupons Add-on. The Coupon Field displays the Field Label, the coupon code entry field and the Description on your form. The end user types in the code to the field and clicks the displayed “Apply” button to reveal the new total.

Coupons reduce the amount subject to the Tax. When GF eCommerce Fields is active, coupon automatically will not include shipping. Coupons will also not influence the value of Subtotal or Discount fields.

Shipping Field

The Shipping Field is a default Gravity Forms field allowing a shipping fee to be added to the form. GF eCommerce Fields alters the default functionality. End users can view the field label, the shipping fee to be paid, and the description.

The shipping value is not included in the subtotal, discounts or coupons. The shipping charge is always included in Tax fields and the form total.

Merge Tags

Gravity Forms uses merge tags to allow you to populate dynamic data in various contexts throughout the plugin. GF eCommerce Fields expands this functionality to provide the {subtotal}, {coupons}, and {discounts} merge tags for use in calculation formulas and other places Gravity Forms merge tags are supported. GFEC also provides support for a {order_summary} for displaying the order summary in notifications and confirmations.

Gravity Forms uses merge tags to allow you to populate submitted field values and other dynamic information in calculation of the field values, notification emails, post content templates, etc.

The following merge tags can be used in calculation of field values.

{subtotal}

The sum of all product prices. This merge tag can be used in calculation of Number and Product Fields in calculation formulas. The result of the formula is dynamically populated as the value for this field.

When used in a Calculated Product, the Calculated Product will automatically exclude itself when calculating the subtotal.

{coupons}

The sum of all coupon deductions. This merge tag can be used in calculation of Number and Product Fields in calculation formulas.

{discounts}

The sum of all discount and coupons deductions. This merge tag can be used in calculation of Number and Product Fields in calculation formulas.

{order_summary}

Gravity Forms provides an order summary that is automatically appended to any entry that has a Gravity Forms Pricing field. It can be inserted into confirmations and notifications using {pricing_fields} merge tag.

GF eCommerce Fields improves on this summary to better support the new Pricing fields it provides. It also adds the improved {order_summary} merge tag as a replacement for {pricing_fields}.

The {order_summary} merge tag displays a preformatted HTML table containing the order summary (the list of products, subtotal, discount, coupons, shipping, taxes and grand total). This merge tag can be used in areas such as notifications and confirmations to preview the order information.

gp-ecommerce-fields-featured-order-summaryExample output of the {order_summary} merge tag.

Do not use {pricing_fields} merge tag; use {order_summary} instead. GF eCommerce Fields changes how some default pricing fields are calculated. The {pricing_fields} merge tag can sometimes display incorrect information.


Translations

You can use the free Loco Translate plugin to create translations for any of our Perks. If you’ve never used Loco translate before, here’s a tutorial written for beginners.

Integrations

Gravity PDF’s Invoicing Templates

GP eCommerce Fields integrates tightly with Gravity PDF’s Invoicing 2.0+ templates. These templates allow for business-ready invoice generation from Gravity Forms submissions, and they’re highly customizable, translatable, and GST/VAT compatible. This integration allows for GP eCommerce Fields’ flexible Tax and Discount fields within Invoicing Templates, including support for tax-exclusive pricing.

There’s a variety of templates to choose from and all templates integrate with GP Advanced Calculations, GP Inventory, GP Conditional Pricing, GP Unique ID, and GP Price Range. Learn more about Gravity PDF’s invoicing templates here.

Developer’s Notes

GF eCommerce Fields makes some changes to how Gravity Forms processes pricing fields. If you are a developer, you will want to be aware of the following.

  • Field types are processed in this order:
    SubtotalDiscountsCouponsShippingTaxesTotal
  • Shipping is automatically excluded from Discounts and Coupons.
  • Shipping is automatically included in Taxes and Total.
  • Coupons are displayed in the totals section of the order summary, rather than the products list.

Known Limitations

  • Excluding products from a Subtotal field does not exclude them from the order’s subtotal. These are separate entities. With that said, if no products are filtered out of a Subtotal field, it will match the order subtotal.

    • So what is the point of filtering which product fields are included in a Subtotal field? These customized subtotals can provide useful feedback to customers on their order by adding multiple subtotals for different groups of products or be used in calculations to simplify formulas. In the future, we plan to make it possible to use a Subtotal field as the amount captured via a payment gateway.
  • The {subtotal} merge tag cannot be included in multiple calculated Product fields. This creates a loop where each Product will increase the subtotal, and the Product fields will be recalculated. You can work around this issue by following these steps:

    1. Create a new Subtotal field on your form and exclude the calculated Product fields. Take note of the field ID.
    2. Insert that specific subtotal merge tag into your form. If the field ID is 9, the format would be: {subtotal:9}.
  • Discount calculations are always based on the Subtotal field. Because of this limitation, the concept of chained discounts is not supported.

    For example, if a Subtotal field has a value of $10, and there are two Discount fields for 10% off, you might expect the second Discount field to use the first Discount field in its calculation. However, both discounts would be $1 and would both be based on the $10 Subtotal field.

FAQs

How can I programmatically set the discount amount?

If you’d like to set the discount for a field programmatically, use this snippet as a blueprint. Follow these steps to use the snippet:

  1. Paste everything below the opening <?php line to your theme’s functions.php file.
  2. Update 123 to your Form ID.
  3. Update 2 to your Discount field ID and set the discount amount.

Can I deduct a deposit from the Order Summary?

We have a snippet that enables deposit deductions. To use it, first download the snippet and add it to your theme’s functions.php file.

Once installed, update the form_id parameter to your form’s ID and the deposit_field_id parameter to the Product field that functions as your deposit.

new GW_Deduct_Deposit( array(
	'form_id'          => 123, // Update "123" to the ID of your form.
	'deposit_field_id' => 4,   // Update the "4" to your deposit field ID.
) );

The deposit will be deducted from the total anywhere the Order Summary is displayed.

How do I pass Stripe fees on to customers?

Stripe fees are calculated using this formula.

To include Stripe fees in your form, follow these steps:

  1. Open your form and add a new Product field under the Pricing Fields header.
  2. Under the General field settings, Set the Field Type to Calculation.
  3. In the Formula box, insert this calculation code:

( ( {subtotal} + 0.30 ) / ( 1 - 0.029 ) - {subtotal} )

The {subtotal} merge tag is powered by Gravity Forms eCommerce Fields. Make sure you have the perk activated in order for this calculation to work.

Hooks

Gravity Forms has hundreds of hooks. Check out our Gravity Forms Hook Reference for the most thorough guide to Gravity Forms’ many actions and filters.


Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.