Cart

The Gravity Forms Cart Add-On lets shoppers add product-form submissions to a cart and pay for the whole cart on one checkout form.

Overview

The Gravity Forms Cart Add-On turns product forms into a store. Each product form adds its submission to a persistent cart. One checkout form collects payment for everything in that cart through a Gravity Forms payment add-on.

You mark each form as a product form or the checkout form under Form Settings → Cart. Product forms can hold their notifications and feeds until the order is paid. The checkout form uses a Cart Summary field and a Total field, and its payment feed charges Form Total so the gateway receives every line.

Shoppers add items from any page where a product form is embedded. A header icon shows the count, and a slide-out drawer lists the cart. Coupons created under Forms → Cart discount the cart subtotal at checkout.

When the payment add-on reports the order paid, the checkout form sends a Customer Receipt and the held product-form notifications and feeds run. Guest carts stay with the shopper for the number of days you set, and items left behind are trashed or deleted on a schedule.

Key Benefits

  • Take payment for several product forms on a single checkout form.
  • Hold product-form notifications and feeds until the order is paid.
  • Show a header cart icon and a slide-out drawer after an item is added.
  • Offer percentage or flat coupons with usage limits, dates, and a minimum subtotal.
  • Match the cart to the checkout form’s colors, or set the accent, text, background, border, radius, and drawer width.
  • Send a Customer Receipt when the order completes, with the shopper’s details and the order summary.

How It Works

Build a form with a Product field, and Option or Quantity fields when you need them. Open Form Settings → Cart and set the role to A product form. Choose whether to hold that form’s notifications and feeds until checkout, then embed the form on a product page.

Build a second form with a Cart Summary field, a Total field, the customer fields you need, and your payment add-on’s field. Set its Cart role to The checkout form. Add a payment feed and set Payment Amount to Form Total. Embed that form on a page, then enter the page URL under Forms → Settings → Cart. The drawer, mini-cart, and add-to-cart confirmation link there.

Add [gravityforms_cart_icon] where the cart badge should appear, or [gravityforms_cart] on a cart page. Turn the drawer on under Forms → Settings → Cart and choose the right or left edge. Create coupon codes under Forms → Cart, and turn on Show a coupon code box on the Cart Summary field.

When a shopper adds an item, the submission is stored on the product form and the confirmation offers Checkout, View cart, and Add another. At checkout they review the lines, apply one coupon, and pay. After the gateway reports payment, the order is complete, the Customer Receipt goes to the Email field, and the product form’s held notifications and feeds are sent.

Provide feedback here

Requirements

  • WordPress 6.5 or later
  • Gravity Forms 2.9.24 or later
  • PHP 7.4 or later
  • A Gravity Forms payment add-on when checkout charges for the order

Changelog

0.1.0-alpha.3

  • Prepared the add-on for Gravity Labs. The add-on URL is now https://labs.gravity.com/cart.
  • Replaced the Labs acknowledgement checkbox with the standard Labs notice on Cart settings and the coupons screen.
  • Deleting the plugin now removes the coupon tables, the coupon code stored on entries, and the customer-receipt setup flag.
  • View more

0.1.0-alpha.2

  • Added coupon codes. Create them under Forms → Cart: percentage or fixed-amount discounts on the cart subtotal, optional minimum subtotal, start/end dates, a total usage limit and a per-customer limit.
  • Added a coupon code box to the Cart Summary field (per-field setting) and coupon endpoints to the REST API (POST/DELETE gf-cart/v1/cart/coupon).
  • Added the discount as a negative line in the checkout form’s product info so the Total field, payment add-ons and the entry Order Summary all reflect it.
  • View more

0.1.0-alpha.1

  • Initial Gravity Labs release.
  • Added per-form Cart roles: Product forms add their submission to a persistent cart; the Checkout form collects payment for the whole cart.
  • Added cart lines as tagged entries on product forms, with guest carts (cookie) and logged-in carts (user meta) that merge on login.
  • View more

Changelog — gravityforms/gravityformscart

0.1.0-alpha.3

  • Prepared the add-on for Gravity Labs. The add-on URL is now https://labs.gravity.com/cart.
  • Replaced the Labs acknowledgement checkbox with the standard Labs notice on Cart settings and the coupons screen.
  • Deleting the plugin now removes the coupon tables, the coupon code stored on entries, and the customer-receipt setup flag.
  • Centered the cart icon, count, and quantity controls in the Appearance preview.
  • Widened the corner radius and drawer width fields so the Inherit placeholder fits.

0.1.0-alpha.2

  • Added coupon codes. Create them under Forms → Cart: percentage or fixed-amount discounts on the cart subtotal, optional minimum subtotal, start/end dates, a total usage limit and a per-customer limit.
  • Added a coupon code box to the Cart Summary field (per-field setting) and coupon endpoints to the REST API (POST/DELETE gf-cart/v1/cart/coupon).
  • Added the discount as a negative line in the checkout form's product info so the Total field, payment add-ons and the entry Order Summary all reflect it.
  • Added the applied coupon to the order snapshot, a "Coupon Code" entry meta column on checkout forms, and {cart_coupon_code}, {cart_discount} and {cart_total} merge tags.
  • Coupon uses are counted once per completed (paid) order and re-validated at checkout, so an expired or used-up code is dropped instead of charged.
  • Per-customer coupon limits now apply to logged-in shoppers at the moment the code is entered, not only at checkout, by resolving the cart token to its owner.
  • When a coupon becomes invalid between being applied and the order being placed, the checkout form now explains which coupon was removed and asks the shopper to review the total, instead of showing the Total field's generic mismatch error.
  • Fixed the REST cart payload reporting the subtotal as the total when a coupon discounts the whole cart to $0.00.
  • Fixed the Forms → Cart coupon list showing a duplicate "Show more details" toggle on each row, and the Add/Edit coupon screen rendering without the Gravity Forms settings styles.
  • Fixed the Forms → Cart page content sitting flush against the admin menu with no left or right gutter.
  • Added a Payment panel to the checkout form's Cart settings. It lists the installed payment add-ons (Stripe, Square, PayPal, etc.) and this form's payment feeds, and warns when a form has no feed or a feed is not charging the Form Total, since such a feed would miss the cart items and coupon discount.
  • Added a warning on product forms that carry a payment feed; payment belongs on the checkout form.
  • Fixed the [gravityforms_cart_icon] mini-cart rendering unstyled, and the drawer not opening, on pages with no cart form (e.g. a shop grid or a block-theme header). The frontend script and stylesheet are now registered on every frontend request and enqueued whenever the shortcode or drawer is used.
  • Added an Appearance section under Forms → Settings → Cart: accent, text, background, border, corner radius and drawer width, with color pickers and a live preview. Leave a field empty to inherit. A "Match Checkout Form Theme" toggle (on by default) copies the checkout form's Orbital Form Styles onto the drawer and mini-cart, which live outside the form and would otherwise stay on the default blue.
  • Added a Customer Receipt notification to checkout forms. It is emailed to the form's Email field when the order completes (after payment, or immediately for a free order) and includes the shopper's details plus the order summary: cart lines, coupon, shipping and the amount charged. Edit it under Form Settings → Notifications. Existing checkout forms receive it the next time wp-admin loads.

0.1.0-alpha.1

  • Initial Gravity Labs release.
  • Added per-form Cart roles: Product forms add their submission to a persistent cart; the Checkout form collects payment for the whole cart.
  • Added cart lines as tagged entries on product forms, with guest carts (cookie) and logged-in carts (user meta) that merge on login.
  • Added the Cart Summary field for the checkout form with quantity steppers, remove buttons and a live subtotal.
  • Added cart line injection into the checkout form's product info so the Total field, payment add-ons and the entry Order Summary all charge and record the full cart.
  • Added a slide-out cart drawer, the [gravityforms_cart_icon] mini-cart shortcode and the [gravityforms_cart] inline cart shortcode.
  • Added a REST API (gf-cart/v1) for reading and editing the cart.
  • Added holding of product-form notifications and add-on feeds until the item is paid for, then replaying them when the order completes.
  • Added order completion on payment (including asynchronous/webhook completion), cart locking against double checkout, and empty-cart handling on the checkout form.
  • Added "In Cart" and "Ordered" entry list filters, Cart meta boxes on line and order entries, and {cart_summary}, {cart_item_count}, {cart_subtotal}, {cart_order_entry_id} and {cart_checkout_url} merge tags.
  • Added "Cart order completed" and "Item ordered from cart" notification events.
  • Added a daily cleanup of abandoned cart lines.
  • Added a Labs "not officially supported" notice to the add-on settings.

Documentation

Cart Add-On Documentation


This is a Gravity Labs project and is not officially supported. The notice on Forms → Settings → Cart is expected.

Cart does not charge a card itself. Product forms add entries to a persistent cart. One checkout form collects payment for the whole cart through any Gravity Forms payment add-on.

Create a product form

Build a normal form with a Product field, plus Option or Quantity fields if you need them. Open Form Settings → Cart and set the role to A product form.

Cart role set to a product form

Option fields, such as Color, show under the item on their own. Show These Fields in the Cart is for other fields, such as a dropdown or a single line of text. That list stays empty when the form only has product, option, and quantity fields. Hold notifications and feeds until the item is paid for at checkout.

Product form options, with notifications and feeds held until checkout

A product page is any page with that form embedded, for example

Oops! We could not locate your form.

. After someone adds the item, the confirmation offers View cart, Checkout, and Add another. The header mini-cart badge updates in place.

Create the checkout form

Build a second form with a Cart Summary field (Pricing Fields), a Total field, the customer fields you need (Email, Address, Shipping), and the payment add-on’s field. Set its Cart role to The checkout form.

Add a payment feed and set Payment Amount to Form Total. Embed the form on a page, then enter that page URL under Forms → Settings → Cart. The drawer, mini-cart, and add-to-cart confirmations link there.

Checkout page URL

The Payment panel on the checkout form’s Cart settings lists the payment add-ons and feeds it found. A feed that does not charge Form Total is flagged, because it would miss the cart lines. Use one feed per gateway, with conditional logic on a payment-method field, when you offer more than one gateway.

Put payment feeds on the checkout form only. A product form with a payment feed is flagged in its Cart settings.

Show the cart

Add [gravityforms_cart_icon] to the header for a mini-cart with a badge, or [gravityforms_cart] on a cart page. In a block theme, open Appearance → Editor → Patterns → Header, add a Shortcode block next to the Navigation block, and paste the shortcode. The icon and drawer work on every page, with or without a form.

Turn the slide-out drawer on under Forms → Settings → Cart, and choose the right or left edge.

Cart drawer enabled on the right

Coupons

Coupons are built in. The Gravity Forms Coupons add-on is not required. Create codes under Forms → Cart.

Coupons screen

  • Type: a percentage of the cart subtotal, or a flat amount that never exceeds the subtotal. Coupons discount cart items only. Shipping and other checkout fields are not discounted, so a 100% coupon plus paid shipping still charges shipping.
  • Limits: total uses, uses per customer (WordPress user, or the checkout form’s Email field for guests), minimum subtotal, start and end dates, and an active toggle. 0 means unlimited.
  • Shoppers enter the code in the Cart Summary coupon box, or remove it from the drawer’s Discount row. Turn the box on per field with Show a coupon code box. One coupon per cart.
  • The discount is a negative line in the checkout form’s product info, so the Total, the payment add-on, and the entry Order Summary all include it.
  • A use is counted when the order completes, not when the code is applied. Codes are checked again at checkout. An invalid code is removed, and the shopper is asked to review the new total before submitting again.

Appearance

Under Forms → Settings → Cart → Appearance, set the accent, accent text, text, secondary text, background, border, corner radius, and drawer width. Leave a field empty to inherit. The drawer, mini-cart badge, Cart Summary, and add-to-cart buttons share these --gf-cart-* values.

Match Checkout Form Theme is on by default. It copies the checkout form’s Orbital styles onto those tokens. A color you set under the toggle wins over the inherited value.

Appearance settings and the cart preview

A theme can set the same tokens:

:root {
	--gf-cart-accent: #111;
	--gf-cart-accent-contrast: #fff;
	--gf-cart-radius: 999px;
}

Cart lifetime

Under Forms → Settings → Cart, set how long a guest keeps the same cart, and when items left in a cart are abandoned. Abandoned items are moved to the trash or deleted.

Cart cookie lifetime and abandoned item cleanup

After an order

Orders complete when the gateway reports payment, including webhooks. A checkout form with an active payment feed does not complete an unpaid order. A form with no payment feed completes immediately, which is how free items work.

The checkout form gets a Customer Receipt notification, sent to the Email field on the “Cart order completed” event. {all_fields} includes the shopper’s details and the order summary. Edit it under Form Settings → Notifications. It is not replaced once created.