Applying Coupon Codes in Adalo

Fixed & Percentage Discounts at Checkout

Purpose

This document explains how to build a coupon code system in Adalo that supports:

  • Fixed dollar discounts (e.g. $5 off)

  • Percentage-based discounts (e.g. 10% off)

The solution uses native Adalo features only—no custom actions, external APIs, or third-party tools.


What This System Supports

  • Validating coupon codes entered by users

  • Applying discounts dynamically at checkout

  • Supporting both fixed and percentage discounts

  • Removing or changing coupons without leaving checkout

  • Using the same logic across carts, orders, or subscriptions


High-Level Flow

  1. Coupon codes are stored in a database

  2. Users enter a coupon code at checkout

  3. Adalo validates the code using a filtered list

  4. The discount is calculated and stored on the logged-in user

  5. Totals are recalculated automatically


Step 1: Create the Coupon Codes Collection

Create a new collection named:

Coupon Codes

Required Properties

Property Name

Type

Purpose

Name

Text

The coupon code users type (case-sensitive)

Amount Off

Number

Dollar amount or decimal percentage

Is Percent Off

True / False

Identifies discount type


Coupon Value Rules

Fixed Discount Example

  • Coupon: $5OFF

  • Amount Off: 5

  • Is Percent Off: false

Percentage Discount Example

  • Coupon: 10OFF

  • Amount Off: 0.1

  • Is Percent Off: true

💡 Tip: Store percentages as decimals. 10% = 0.1, 20% = 0.2, etc.



Step 2: Add Coupon Input to Checkout Screen

On your checkout or payment screen:

Add a Text Input

  • Label: Coupon

  • Purpose: User enters the coupon code

Add a List

  • Collection: Coupon Codes

Filter: Name = Coupon Input

Optional Visibility Rule

Coupon Input is not empty

💡 Why this matters This prevents invalid coupons from appearing and hides UI when no code is entered.



Step 3: Add an Apply Coupon Button

Inside the Coupon Codes list, add a button:

  • Label: Apply

  • (Optional) Show the coupon name for testing/debugging

This button will trigger the discount logic.


Step 4: Create the Coupon Amount Property

On the Logged-In User collection, create a number property:

Coupon Amount

This property stores the actual dollar value of the discount, regardless of coupon type.


Step 5: Fixed Amount Discount Logic

Button Action

Update Logged-In User

Only Run If

Is Percent Off = false

Set Value

Coupon Amount = Amount Off

Example

  • $5 off → Coupon Amount = 5


Step 6: Percentage Discount Logic

Percentage discounts must be converted into a dollar amount.

Button Action

Update Logged-In User

Only Run If

Is Percent Off = true

Formula

Coupon Amount = Amount Off × Cart Subtotal

Example

$9.00 × 0.1 = $0.90

⚠️ Important Always calculate the percentage against the subtotal before tax.



Step 7: Show Coupon in Checkout UI

Use conditional visibility to keep the UI clean.

Visibility Rule

Coupon Amount > 0

Display Elements

  • Coupon label

  • Discount value (shown as a negative amount)

  • Optional “Remove Coupon” button


Step 8: Remove Coupon Option

Add a small X or Remove Coupon button.

Click Action

Update Logged-In User

Coupon Amount = 0

Visibility Rule

Coupon Amount > 0

This allows users to remove a coupon without restarting checkout.


Step 9: Update Subtotal & Total Calculations

Subtotal Formula

Subtotal = Cart Subtotal − Coupon Amount

Total Formula

Total = (Cart Subtotal − Coupon Amount) + Tax

This logic works for:

  • Single-item carts

  • Multi-item carts

  • Add-ons

  • Persistent user carts


Best Practices & Notes

  • Coupon codes are case-sensitive

  • Store the coupon value on the logged-in user for easy access

  • Admins can manage coupons directly in Adalo

  • This pattern works without custom actions or external tools


Summary

This setup allows you to:

  • Validate coupon codes natively

  • Support both fixed and percentage discounts

  • Apply coupons dynamically at checkout

  • Keep all logic inside Adalo

It’s flexible, scalable, and production-ready.

Last updated

Was this helpful?