Build a storefront against real commerce data before you have a store (mock.shop) - #3075
Build a storefront against real commerce data before you have a store (mock.shop)#3075BobbyNguye wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1878dcb68b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| - responses | ||
|
|
||
| - title: Build a storefront against real commerce data before you have a store | ||
| path: examples/build_a_storefront_against_mock_data.ipynb |
There was a problem hiding this comment.
Move the notebook into a topic directory
This new notebook is registered directly under examples/, but new notebooks must be organized under examples/<topic>/. Move it into an appropriate topic folder, such as examples/shopify/, and update this registry path accordingly.
AGENTS.md reference: AGENTS.md:L3-L5
Useful? React with 👍 / 👎.
| " return response.json()\n", | ||
| "\n", | ||
| "\n", | ||
| "if os.environ.get(\"SHOPIFY_STORE_DOMAIN\") and last_query:\n", |
There was a problem hiding this comment.
Require the storefront token before entering the live branch
When SHOPIFY_STORE_DOMAIN is set but SHOPIFY_STOREFRONT_ACCESS_TOKEN is absent, this condition enters the live branch and storefront_query_live raises KeyError, contradicting the preceding claim that the call runs only when both values are set. Check both environment variables before invoking the external service.
AGENTS.md reference: AGENTS.md:L20-L22
Useful? React with 👍 / 👎.
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": 2, |
There was a problem hiding this comment.
Clear the committed execution counts
The notebook commits execution counts 2 through 8 even though the repository requires lingering execution counts to be cleared before committing; the first executed setup cell is already null, making the saved numbering inconsistent as well. Clear the remaining execution_count fields after the final top-to-bottom run.
AGENTS.md reference: AGENTS.md:L20-L22
Useful? React with 👍 / 👎.
Summary
A function-calling recipe for a common situation: a developer is building an online shop, doesn't have a Shopify store yet, and needs real commerce data to build against. Instead of inventing a JSON file of fake products, the model uses mock.shop, Shopify's public Storefront API backed by 100+ fictional stores that needs no store, app, or access token.
The notebook gives the model three tools (list the store directory, read a store's
llms.txt, run a Storefront API GraphQL query), then asks it to set up a backend for "a shop that sells handcrafted furniture." The model picks the furniture store from the directory, learns its collections, writes and runs the query, and the notebook renders the six products as a homepage grid with real images and prices. The last section shows that the query the model wrote runs unchanged against a real store: only the endpoint and a token change.Motivation
Coding agents asked to "build a shop" tend to fabricate product data, which produces storefronts that work against fake data and break against real data. This recipe shows the pattern that avoids it and is fully runnable with only
OPENAI_API_KEY; the commerce API side needs no credentials at all.What's in the PR
examples/build_a_storefront_against_mock_data.ipynb, executed end to end with outputs saved (Responses API,gpt-5.5, function calling withprevious_response_id).registry.yamlentry (tags:functions,responses) and anauthors.yamlentry..github/scripts/check_notebooks.pypasses locally.About the author
I work on mock.shop at Shopify. The recipe uses only public endpoints and Shopify's public docs: https://shopify.dev/docs/storefronts/headless/mock-shop