Build a price comparison feature in Bubble by fetching prices from multiple sources via the API Connector, displaying them in a sortable comparison table using a Repeating Group, highlighting the best deal, and setting up price drop alerts via backend workflows. This gives your app real comparison shopping functionality without code.
Overview: Building a Price Comparison Feature in Bubble
This tutorial shows you how to build a price comparison feature in Bubble. You will integrate with external APIs to fetch prices from multiple retailers or sources, display them side-by-side in a comparison table, sort by price, highlight the lowest option, and notify users when prices drop below a threshold. This is ideal for shopping comparison sites, product aggregators, or any app that helps users find the best deal.
Prerequisites
- A Bubble account with an existing app
- API Connector plugin installed
- Access to at least one external pricing API (retailer API, affiliate network, or custom data source)
- Basic understanding of Bubble workflows and Repeating Groups
Step-by-step guide
Create the price comparison data types
Create the price comparison data types
Go to the Data tab and create two data types. Product with fields: name (text), description (text), image (image), and category (text). PriceEntry with fields: product (Product), source_name (text, e.g., Amazon, Walmart), price (number), url (text, link to the product on the source), currency (text), and last_updated (date). This structure separates the product identity from its prices across different sources.
Expected result: Product and PriceEntry data types exist with fields for multi-source price tracking.
Configure API calls to fetch prices
Configure API calls to fetch prices
Go to the Plugins tab and open the API Connector. Create a new API for each price source. For example, create an API called RetailerAPI with a call named GetPrice. Set the method to GET, enter the retailer's API URL with the product identifier as a parameter, and configure authentication (typically API key in header, marked Private). Initialize each call with a test product ID to map the response structure including price, product name, and URL fields.
Pro tip: If the retailer does not have a public API, consider using an affiliate network API like CJ Affiliate or ShareASale that aggregates product data from multiple retailers.
Expected result: API Connector calls are configured and initialized for each price source with response mapping complete.
Build the price refresh workflow
Build the price refresh workflow
Create a backend workflow called refresh_prices with parameter product_id (text). In it: look up the Product by ID, then call each retailer API with the product identifier. For each response, search for an existing PriceEntry (product = this product, source_name = this source). If it exists, update the price and last_updated. If not, create a new PriceEntry. Schedule this workflow to run daily for each product, or trigger it on demand when a user views a product page.
Expected result: Prices from all sources are fetched and stored in PriceEntry records, updated daily or on demand.
Display the comparison table
Display the comparison table
On your product detail page, add a Repeating Group with type PriceEntry and data source: Do a search for PriceEntries where product = Current Page Product, sorted by price ascending. In each cell, display: source_name, price (formatted with currency symbol), last_updated (formatted as a relative date like 2 hours ago), and a Visit Store button that opens the url in a new tab. The lowest price appears at the top since the list is sorted ascending.
Expected result: A comparison table shows all source prices sorted from lowest to highest with links to each retailer.
Highlight the best deal with conditionals
Highlight the best deal with conditionals
Add a conditional to the first cell of the Repeating Group: When Current cell's index is 1, change the background color to light green and add a Best Price badge text element with conditional visibility (only visible when index is 1). For additional context, add a Text element showing the savings: max price minus min price, displayed as Save $X compared to the highest price. Calculate this using the PriceEntry search with sort descending first item's price minus ascending first item's price.
Expected result: The lowest price row is highlighted green with a Best Price badge, and the potential savings amount is displayed.
Set up price drop alerts
Set up price drop alerts
Create a data type called PriceAlert with fields: user (User), product (Product), target_price (number). Add an Alert Me button on the product page that opens a popup where users enter their target price. Create the PriceAlert on save. In the refresh_prices backend workflow, after updating prices, add a step: Search for PriceAlerts where product = this product and target_price >= the new lowest price. For each match, send an email notification to the user with the current best price and source link. For complex comparison platforms with many data sources, consider working with RapidDev for expert Bubble development.
Expected result: Users can set price targets and receive email notifications when the price drops to or below their threshold.
Complete working example
1PRICE COMPARISON FEATURE — WORKFLOW SUMMARY2=============================================34DATA TYPES:5 Product6 - name (text)7 - description (text)8 - image (image)9 - category (text)1011 PriceEntry12 - product (Product)13 - source_name (text)14 - price (number)15 - url (text)16 - currency (text)17 - last_updated (date)1819 PriceAlert20 - user (User)21 - product (Product)22 - target_price (number)23 - is_active (yes/no)2425BACKEND WORKFLOW: refresh_prices26 Parameter: product_id (text)27 Runs: daily or on-demand28 Step 1: Look up Product by ID29 Step 2: Call RetailerA API30 Step 3: Upsert PriceEntry for RetailerA31 Search existing → update price + last_updated32 OR create new PriceEntry33 Step 4: Call RetailerB API34 Step 5: Upsert PriceEntry for RetailerB35 Step 6: Find lowest new price36 Step 7: Search PriceAlerts37 product = this product38 target_price >= lowest price39 is_active = yes40 Step 8: Send email notifications to matched alerts41 Step 9: Deactivate triggered alerts4243PAGE: product-detail44 Elements:45 - Product info (name, image, description)46 - Repeating Group (type: PriceEntry)47 Data source: Search for PriceEntries48 product = Current Page Product49 Sort: price ascending50 Cell contents:51 - Text: source_name52 - Text: price (formatted $#,##0.00)53 - Text: last_updated (relative)54 - Link: Visit Store → url (new tab)55 - Conditionals:56 Cell index 1 → green background + "Best Price" badge57 - Text: Savings calculation58 highest price - lowest price59 - Button: Set Price Alert60 → Opens popup with target price input6162WORKFLOW: Set price alert63 Event: Button Save Alert is clicked64 Action: Create new PriceAlert65 user = Current User66 product = Current Page Product67 target_price = Input Target Price's value68 is_active = yesCommon mistakes when building price comparison in Bubble
Why it's a problem: Calling retailer APIs on every page load instead of caching results
How to avoid: Cache prices in PriceEntry records and refresh them on a schedule (daily or hourly) via a backend workflow.
Why it's a problem: Not handling API failures gracefully
How to avoid: Check each API response for errors before creating/updating PriceEntry records. Show the last known price with a stale data indicator if the refresh fails.
Why it's a problem: Displaying prices without the last_updated timestamp
How to avoid: Always show the last_updated date formatted as a relative time (e.g., Updated 3 hours ago) next to each price.
Best practices
- Cache prices in the database and refresh on a schedule rather than calling APIs on every page view
- Sort the comparison table by price ascending so the best deal is always first
- Show the last_updated timestamp so users know how fresh the data is
- Add a Best Price badge to the lowest-priced option for quick visual identification
- Include direct links to the retailer product page so users can purchase easily
- Set up price drop alerts as a user engagement feature that brings people back to your app
- Handle API failures gracefully by showing cached data with a stale indicator
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I am building a price comparison feature in Bubble.io. I need to fetch prices from multiple retailer APIs, display them in a sortable comparison table, highlight the lowest price, and alert users when prices drop. What data types and workflows do I need?
Build a price comparison feature for my product pages. Create Product and PriceEntry data types, configure API calls to fetch prices from multiple sources, display a sorted comparison table with a Best Price highlight, and add price drop alert notifications.
Frequently asked questions
What if a retailer does not have a public API?
Use affiliate network APIs (CJ, ShareASale, Amazon Associates) that aggregate product data. Alternatively, manually enter prices or let users submit prices they find.
How do I handle different currencies from different sources?
Store prices in a base currency and convert at display time using cached exchange rates. See the multi-currency e-commerce tutorial for the conversion pattern.
Can I sort the comparison table by columns other than price?
Yes. Add a Custom State for the sort field and use conditional data sources on the Repeating Group that change the sort parameter based on the selected column header.
How often should I refresh prices?
It depends on your sources. For retail products, daily is usually sufficient. For airline tickets or hotel prices that change frequently, consider hourly updates.
Can RapidDev help build a comparison platform?
Yes. RapidDev specializes in Bubble development and can help build full comparison platforms with multiple API integrations, automated data collection, and advanced filtering and sorting features.
Will the price alert emails count toward Bubble's email limits?
Yes if you use Bubble's built-in email. For higher volumes, integrate SendGrid or Mailgun via the API Connector for better deliverability and no Bubble email limits.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation