Skip to content

Teach Hydrogen templates and skills about mock.shop's store catalog - #3986

Open
BobbyNguye wants to merge 7 commits into
Shopify:previewfrom
BobbyNguye:bobby/mock-shop-store-catalog-preview
Open

Teach Hydrogen templates and skills about mock.shop's store catalog#3986
BobbyNguye wants to merge 7 commits into
Shopify:previewfrom
BobbyNguye:bobby/mock-shop-store-catalog-preview

Conversation

@BobbyNguye

Copy link
Copy Markdown

Preview-branch version of #3984 and #3985. Those target main, which is frozen; this re-does the work for Hydrogen 3, where there is no scaffolding CLI, so the change lives in the templates, the packaged skills, the checkout interceptor, and the example app.

TL;DR: mock.shop is not one store. It is a catalog of fictional stores, each on its own host, listed at https://mock.shop/llms.txt. Hydrogen treated it as a single endpoint, so anyone building without a store always got the default apparel catalog and no agent knew there was a choice. This PR lets developers pick a store with the store-domain env var they already have, and teaches agents that the catalog exists.

Before

// templates/react-router/app/lib/storefront.ts
const storeDomain = usingMockShop ? "mock.shop" : getStoreDomain(env);

In mock mode PUBLIC_STORE_DOMAIN was ignored. The skills described mock.shop only as "all tokenless access supports".

After

const storeDomain = usingMockShop ? getMockShopDomain(env) : getStoreDomain(env);
// PUBLIC_STORE_DOMAIN=pets.mock.shop -> that store's catalog, still mock mode
// PUBLIC_STORE_DOMAIN=            -> the default store at mock.shop

What this changes

  • Core: cart permalinks hand off to demostore.mock.shop for every *.mock.shop host, not only the bare mock.shop. Per-store hosts do not render /cart/..., so the old check sent buyers to a 404.
  • React Router template: a mock.shop host in PUBLIC_STORE_DOMAIN selects that store and implies mock mode. .env.example, the README, and AGENTS.md ("No store yet?") explain the directory.
  • Next.js template: the same through NEXT_PUBLIC_STORE_DOMAIN. The mock-mode warning names the store in use and points at the directory.
  • Skills: hydrogen-storefront-client and hydrogen-setup explain that mock.shop is a catalog and how to pick a store whose categories match what the user is building.
  • Hydrogen example: the homepage notice says how to pick another store, the isShopLinked gate keeps showing it for per-store hosts (still mock data), and a mockShopStore e2e env plus smoke spec boot the example against pets.mock.shop.

Developer impact

Includes a patch changeset for @shopify/hydrogen: the checkout interceptor fix and the skill guidance. No new exports and no runtime contract changes. Templates are in the changeset ignore list, so their changes carry no bump.

One behaviour change in the React Router template: PUBLIC_STORE_DOMAIN=<store>.mock.shop together with a private token now runs in mock mode (mock buyer IP, no storefront ID, well-known mock token) instead of real-store mode. .myshopify.com domains are unaffected.

UX impact

The example app's homepage notice has new copy and links to https://mock.shop/llms.txt. The templates have no visible change unless a store is chosen.

Out of scope

  • No interactive store picker. preview has no init, so choosing a store is an env-var edit guided by docs and skills. Let init pick a mock.shop store #3985 has no equivalent here.
  • No new env var. Reusing the store-domain variable matches the example app and the shopify.dev mock.shop page.

Risk

  • The mock.shop host check is a suffix match on .mock.shop, duplicated in core and both templates instead of exported from core, to keep templates dependency-light.
  • The mockShopStore smoke spec depends on pets.mock.shop staying published with a collection image and product images. It has both today.

How to Test

  1. Run pnpm install && pnpm build:pkgs.
  2. In templates/react-router, run cp .env.example .env, set PUBLIC_STORE_DOMAIN=pets.mock.shop, and run pnpm dev.
  3. Open the printed local URL. The catalog is the "Paws and Whimsy" pet store, not apparel.
  4. Clear PUBLIC_STORE_DOMAIN and reload. The default apparel catalog is back.
  5. In templates/nextjs, run cp .env.example .env, set NEXT_PUBLIC_STORE_DOMAIN=pets.mock.shop, and run pnpm dev. Open http://localhost:3000. The server log says Running against mock.shop (pets.mock.shop) and the catalog is the pet store.
  6. In examples/hydrogen, run pnpm e2e:smoke -g "mock.shop store". The spec boots the example against pets.mock.shop, sees the notice with the directory link, and finds products.

mock.shop serves many stores, each on its own host (pets.mock.shop, ...),
and none of them renders cart permalinks. The checkout interceptor only
special-cased the bare mock.shop host, so a storefront pointed at a
per-store host sent buyers to a 404. Treat every *.mock.shop host the
same way and redirect to demostore.mock.shop.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726
Mock mode hard-coded the default store at mock.shop. mock.shop is a
catalog of stores on their own hosts, so let a mock.shop host in
PUBLIC_STORE_DOMAIN select that store's catalog (and imply mock mode).
Document the directory at https://mock.shop/llms.txt in .env.example,
the README, and AGENTS.md so developers and agents know they can choose.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726
Same change as the React Router template: a mock.shop host in
NEXT_PUBLIC_STORE_DOMAIN selects that store's catalog and keeps the app
in mock mode (no Customer Accounts, well-known mock token). The warning
now names the store in use and points at the directory.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726
The storefront-client and setup skills described mock.shop as a single
tokenless endpoint. Teach agents to read https://mock.shop/llms.txt,
pick the store whose categories match what the user is building, and
use its host as storeDomain.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726
… host

The homepage notice now says how to pick another mock.shop store, and
the isShopLinked gate keeps showing it for per-store hosts such as
pets.mock.shop, which are still mock data. Adds a mockShopStore e2e env
and smoke spec that boots the example against pets.mock.shop.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726
@BobbyNguye
BobbyNguye marked this pull request as ready for review September 3, 2026 20:36
@BobbyNguye
BobbyNguye requested a review from a team as a code owner September 3, 2026 20:36
Content review: "many stores" is vague. The directory lists more than
100 sample stores, so say so in both AGENTS guides and the example
homepage notice.

Assisted-By: devx/c47f963e-a81e-4fb1-b892-875281ad7726

@fredericoo fredericoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good! works fine for several mock shops

mock.shop now serves a mock checkout on each store's storefront host: no
payment is taken and no real order is placed. The templates said checkout
doesn't work, which would steer an agent away from a flow it can build
and demo.
@BobbyNguye
BobbyNguye force-pushed the bobby/mock-shop-store-catalog-preview branch from 74ef3ef to b48738e Compare September 8, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants