Storing query parameters and sending them to API via webhook

Topic summary

Capturing URL hash parameters on a Shopify product page and persisting them for use in an order webhook.

  • Goal: Parse values after the hash (#) in the product URL (e.g., #ID=“12345”&VAR=“6789”), store them, and attach them to an API request triggered via an order webhook.
  • Current status: An app and a webhook for request authentication are already set up.
  • Gaps: How to parse the query string on the product page, how to store the variables so they persist as the user navigates before ordering, and how to include them in the order webhook payload.
  • Constraints: Cannot modify product details; storage should be handled by the app rather than altering product data.
  • Questions: Whether metaobjects are appropriate for storing these variables, and how to inject/query parsing code into the product page.
  • Outcome: No answers yet; seeking implementation pointers. Discussion remains open.
Summarized with AI on January 5. AI used: gpt-5.

Hi there,

I am new to shopify and trying to find my way around so I would appreciate if you have pointers for the below scenario.

  1. I would like my app to get the query strings that are added to my product page url after #. For ex getting ID and VAR out of http://quickstart-6ccf081c.myshopify.com/products/the-collection-snowboard-liquid#ID=“12345”&VAR=“6789”

  2. I would like to store these variables and attach them to my API request via webhook

I managed to create an app and a webhook to authenticate requests. The missing pieces are parsing query string, storing them (as the user may move to other pages before order) and use them at my order webhook. I cannot modify the product details as this will be an app so the data should be stored by the app.

For ex. do I use metaobjects to store these variables? How do I insert my code for query string parsing to the product page?

Thanks