Summary

We tried setting this up with Gravity Forms Coupons. It did work to apply the discounts, but Square will not process a $0 payment. So if the total was $0 after the discount code was applied, we needed to hide/disable the credit card fields.

We recently had a situation where we were setting up conference registration for a client. There were several discount codes provided to presenters, keynote speakers, and vendors. We were using Gravity Forms for the registration forms, along with the Square add-on for payment processing.

The challenge:

We tried setting this up with Gravity Forms Coupons. It did work to apply the discounts, but Square will not process a $0 payment. So if the total was $0 after the discount code was applied, we needed to hide/disable the credit card fields.

However, there’s no way to do this with conditional logic, because the “Total” field value cannot be read by Gravity Forms. We could use conditional logic based on the coupon code, but that didn’t work because it’s possible that someone would enter a coupon code and still buy more registrations, or vendor tables, or add on a donation to their registration. We needed to figure out how to read the Total field value for our conditional credit card field.

Enter Gravity Perks. Instead of the GF Coupons add-on, we switched to GP eCommerce fields and used the Discount field. And to get the value of the Total field, we used GP Copy Cat.

We also set the Square feed to process only if the Copy Cat field had a value of not-zero.

Set Square Feed to process only if price is not 0

So the steps are:

  1. Install Gravity Forms, Square, GP eCommerce Fields and GP Copy Cat and enter your license keys.
  2. Connect the Square Add-on to your Square account.
  3. Add a Single Line Text field to the form where the registrant can enter the discount code.
  4. Add a Discount field to the form with conditional logic based on the content of that field.
  5. If a particular form can have more than one discount code, set up additional Discount fields—one for each code that can be applied. Each one should be for the amount of that code, and be displayed via conditional logic if the Single Line Text field contains the matching code.
  6. Add a Hidden Field (Pricing Copy) to the form. This will hold the value from the Total field so that we can use it for our Credit Card logic.
  7. Add the following CSS class to the Total field: copy-13-to-22 (this is in the format copy-{fieldID}-to-{fieldID} where the first ID is the Total field, and the second ID is the Price Copy hidden field. (This gets the value from the Total field into a field we can base our Conditional Logic on.)
  8. Set conditional logic on the Square credit card field so that it is Hidden if Price Copy=0
  9. Set conditional logic on the Square Feed so that it is processed only if Price Copy is not 0.

This will allow your discount codes to be applied, but only show/process the credit card fields if the total of the form is greater than zero.

Screenshot of new fields and CSS class