Using personalized data for product description (via api)

Topic summary

Goal: Personalize product descriptions using a customer metafield and product SKU, sending them to an endpoint to compute user-specific details, without exposing API keys.

Feasibility: Possible, but not safely with only Liquid/JavaScript, as that would expose credentials.

Recommended architecture:

  • Store customer data in Metafields via a private app using the Shopify API.
  • Create a secure middleware/server that:
    • Accepts customer ID and product SKU from the storefront.
    • Fetches needed data via Shopify API, calls your computation endpoint, and returns results.
  • From the storefront, use Liquid/JavaScript to call the middleware with token-based authentication and update the product description dynamically.
  • To improve performance, use webhooks or background jobs to pre-calculate results and cache them on your server or in Shopify Metafields, reducing page-load latency.

Outcome/Status: No concrete implementation chosen. The thread outlines a scalable, secure pattern and suggests consulting a Shopify expert. Discussion remains open with implementation details (auth, caching, job triggers) to be decided.

Summarized with AI on January 22. AI used: gpt-5.

I would like to take customer information (e.g. for logged in customers, a metafield), and based on that information, show a product description.

I want to use a customer metafield information, together with a product sku, and send them to an endpoint, where I will calculate specific details for that particular user and product. I want to show those information in the product description.

I thought this is possible by simply using JS and liquid - but that would expose a security risk as I would have to use my api key - and I would therefore prefer another solution.

What would the best and most scalable way be to implement this? Is it possible at all?

Complex one. You could save additional metadata for customers using Metafields along with the Shopify API by creating a private app. You didn’t say if you have already done so?

If you want to protect your API keys, maybe with a separate server to run the computations. Or develop a middleware API on your secure server that will communicate with Shopify’s API and your custom endpoint for calculation, taking SKU and customer metafield as input, fetch the necessary data, send the data to your endpoint for calculation, and return the response. Easy-peasy-lemon-squeezy…NOT! :wink:

In your storefront, use Liquid and JavaScript to call your Middleware API. The product description can be dynamically updated based on the response from your Middleware API with some token-based authentication between your frontend and your Middleware API.

Use a webhook or background job to pre-calculate the specific details and store them in your server or Shopify’s Metafields to avoid delays in page loading due to API calls.

Here a possible flow:

  • User visits your product page
  • JavaScript in the product page makes a request to the Middleware API with customer ID and product SKU
  • API fetches data using Private App and sends data to the custom endpoint which returns specific details
  • Middleware returns details to the frontend which updates product description based on the returned details.

Hope that will get you in the right direction… Any further questions - consult a Shopify expert.

1 Like