Repository navigation
Conversation
This was referenced Nov 19, 2026
Ji-One1
marked this pull request as ready for review
November 20, 2026 05:41
Wrap the product page in ProductView with context page, and each product card with the context of its list: collection, search, or recommendation. Add the product ID to the product card fragment.
Add ProductView to the product page and product cards of the Hydrogen, Next.js, and Nuxt examples. The SvelteKit and Solid examples render the shopify-product-view element with getProductViewAttributes. Solid sets the attributes with attr:, because the element reads HTML attributes.
Ji-One1
force-pushed
the
jb/hydrogen-product-view-apps
branch
from
November 20, 2026 06:24
d8bc01a to
d2fbef4
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #4376. Refs Shopify/developer-tools-team#1285
Part 2 of 4. Adds
ProductViewfrom #4376 to the React Router template and the examples.TL;DR: The template and all five examples now send
shopify:product:viewon product pages and product cards.Before
The template and examples send no product view event.
After
Product pages are wrapped in
<ProductView context="page">, and each product card in<ProductView context="collection" | "search" | "recommendation">, with the context of the list that shows it.What this changes
ProductViewon the product page, on product cards (home and collection pages usecollection, search usessearch, related products userecommendation), and in the search drawer. The product card fragment now asks for the productid.ProductViewcomponents.shopify-product-viewelement withgetProductViewAttributes(). Solid sets the attributes withattr:, because the element reads HTML attributes.blockclass, so the visibility check can measure them.Developer impact
No changeset: these are template and example changes only. They show the supported pattern for
ProductView.UX impact
No visible change. The new element wraps the existing markup, with a
blockclass, and keeps the same layout, accessible names, and test IDs.Risk
How to Test
pnpm install && pnpm build:pkgs.templates/react-router, runpnpm dev. With no.env, the template uses mock.shop.document.addEventListener("shopify:product:view", (e) => console.log(e.context, e.product.handle, e.target.tagName), true).collectionlog for each card when it comes into view, and no duplicates.pagelog with that handle and theSHOPIFY-PRODUCT-VIEWtarget.pagelog.recommendationlogs.pagelog.searchlogs for the visible results.debug={{ standardEventsInspector: true }}to<ShopifyScripts>inapp/root.tsx, reload a product page, and confirm that the inspector shows oneshopify:product:view.