How to Create a Secure and Dynamic Shopify Page to Display Real-Time Discount Details?

Topic summary

Core Challenge:
Fatina seeks to create a dynamic Shopify page that automatically displays real-time discount details (title, type, value, requirements, applicable products/collections) from Shopify Admin, updating whenever discounts are created or edited.

Recommended Solutions:

Custom App with Webhooks (tobebuilds):

  • Hook into DISCOUNTS_CREATE, DISCOUNTS_UPDATE, and DISCOUNTS_DELETE webhooks
  • Serialize discount information to shop metafields
  • Create custom Liquid sections to read and display metafield data
  • Note: Liquid cannot fetch products by ID, so product details must be serialized into metafield data

Backend Proxy with Admin API (Avitanshi_17):

  • Set up secure server (Node.js/Python) to handle API requests
  • Use Admin API to fetch discount details without exposing API keys on frontend
  • Implement HTTPS and CORS policies for security
  • Frontend JavaScript fetches data from proxy and renders dynamically
  • Code example provided for Node.js/Express implementation

Key Limitations:

  • Shopify Liquid lacks direct access to discount details
  • Storefront API doesn’t expose detailed discount rules/conditions
  • API key security requires proper OAuth, token management, and avoiding plaintext storage

Status: Discussion remains open with two viable technical approaches presented.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello, I want to create a dynamic page on my Shopify store to display discount details (such as title, type, value, minimum requirements, and applicable products/collections) from Shopify Admin > Discounts. The page should update automatically whenever discounts are created or edited.

I’ve tried using an app, but it didn’t work as expected. I’m considering the following options:

  1. Using the Shopify Admin API, but I’m concerned about API key security.
  2. Setting up a secure backend proxy to fetch and display discounts via JavaScript.
  3. Shopify Liquid/Storefront API, although Liquid doesn’t seem to provide direct access to discount details.

What’s the most secure and efficient way to achieve this? Any guidance or examples would be greatly appreciated!

Hi Fatina, I recommend that you create a custom app.

Requirements:

  • Hook into DISCOUNTS_CREATE, and DISCOUNTS_UPDATE and DISCOUNTS_DELETE webhooks
  • Serialize information about each discount (such as type, method, active dates, product eligibility) to a metafield on your shop.
  • Create a custom section in Liquid that reads this metafield, and displays information about each discount to the user.
  • Add this section to any pages where you want the discount information.

As you can imagine, this is quite open-ended and really depends on the specifics of how you want the page to look. Some heads up for when you’re implementing the code for this app:

  • To read info about a collection by handle in Liquid, use collections[HANDLE_HERE]
  • Liquid doesn’t have a good way to fetch a product by ID, so whatever product information you want to display (eg. title, images, etc.) should also be serialized into the metafield data.

As for API key security, that’s really up to you. Just don’t give it to anyone you don’t trust. Avoid storing your key in plaintext files, etc. If you want, you can rotate your keys periodically.

Hope this helps,

Tobe

1 Like