Want to redirect customers to another product based on selected variant

Topic summary

Goal: redirect customers to specific product URLs based on the selected variant, similar to a referenced product page.

Constraint: Shopify natively supports only 3 variant options; 4th/5th options added via an app do not produce a variant ID in the URL, making detection and redirect logic difficult.

Proposed approaches:

  • Use variant metafields to store target URLs and trigger a redirect on variant change.
  • Implement JavaScript that reads the selected (native) variant and maps it to a redirect URL.
  • Retrieve variant IDs via the Shopify Admin API; this requires credentials and typically isn’t callable directly from the storefront.

Latest update: A test product link and password were provided, confirming that selections from the app-created 4th/5th options do not update the URL with a variant ID.

Key guidance: Ensure the extra options are rendered and integrated like Shopify’s default 3 variant options; otherwise they won’t correspond to real variant IDs.

Note: Code snippets (JavaScript redirect mapping and Admin API fetch) are central to the proposed solutions.

Status: Unresolved; next steps are to make app options compatible with Shopify’s variant system or use custom JS/metafields-based redirects.

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

Are the 4th and 5th options rendered with the same code as default 3 ?
I don’t think they are so please first make them compatible with the default code.