Skip to content

feat(shopping): a US / Europe market switch for ChatGPT Shopping, with its source per market - #1459

Merged
gkhngyk merged 2 commits into
mainfrom
feature/shopping-market-switch
Oct 24, 2026
Merged

gkhngyk merged 2 commits into
mainfrom
feature/shopping-market-switch

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Summary

A US / Europe market switch for ChatGPT Shopping on the Shopping page, with where ChatGPT's products come from in each market.

  • One country-to-market helper (web/src/lib/shopping/markets.ts):
    • US and US state codes (US-CA) map to the US.
    • EU / EEA countries, the UK and Switzerland map to Europe.
    • Anything else maps to none.
    • The helper also holds the default-market rule and each market's region codes.
  • The brand's countries come from its domains' country and every location code its prompts track, read past the 1,000-row cap (getBrandMarketCountries).
  • Default market:
    • US when the brand has US countries.
    • Europe when all of them are European.
    • None otherwise; then there is no switch and no source claim.
    • The choice is remembered per brand in localStorage.
  • Source line:
    • US: "OpenAI product index · via Shopify".
    • Europe: "Google Shopping · via Merchant Center".
  • Filtering. The switch keeps ChatGPT Shopping's cards to the market's regions, in the card reads and in the Overview. Other platforms' cards are unaffected.
    • A picked region already narrows every platform, so the switch then follows that region.
    • Choosing a market clears the region.
  • Migration 00267_shopping_overview_chatgpt_market adds p_chatgpt_regions text[] default null to shopping_overview.
    • With null it reads exactly what the function read before.
    • The 6-argument version is dropped, so PostgREST sees one candidate. Its grants are restored as they are on prod.
    • Reports call it without the new argument and are unchanged.
    • Apply it before the web deploys.

Readiness, the Content Editor Shopping tab, the OpenAI index rows (#1281) and the Google Shopping listings (#1285) don't exist yet. They will share this helper and the switch's state.

Prod dry run (rolled back), on the brand with the most cards, as a member:

  • shopping_overview takes 62–119 ms over 30 and 90 days, with and without the US list.
  • Without the argument, the output is identical to the current function.

Related issue

Closes #1278

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open Shopping for a brand with US prompts or a US domain. The switch opens on US with the OpenAI source line.
  2. Switch to Europe. The source line changes, and ChatGPT Shopping cards and Overview figures keep to European regions. Other platforms' figures don't change.
  3. Pick a single region in the filter bar. The switch follows that region; choosing a market resets the region to All.
  4. Reload. The market choice is kept for that brand.
  5. A brand whose countries are outside both markets shows no switch.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

…h its source per market (#1278)

- lib/shopping/markets: one country-to-market helper. US and US state
  codes map to the US; EU / EEA countries, the UK and Switzerland to
  Europe; anything else to none. Also the default market and each
  market's region codes.
- getBrandMarketCountries reads the brand's domain countries and every
  prompt's location codes (paged past the 1,000-row cap).
- The Shopping page opens on the US when the brand has US countries and
  on Europe when all of them are European. With no market it shows no
  switch and makes no source claim. The choice is remembered per brand
  in localStorage.
- The switch shows where ChatGPT's products come from in each market and
  keeps ChatGPT Shopping cards to that market's regions in the card
  reads. Other platforms' cards are unaffected. A picked region already
  narrows every platform, so the switch then follows that region, and
  choosing a market clears the region.
…arket (#1278)

- 00267 adds p_chatgpt_regions to shopping_overview. It narrows ChatGPT
  Shopping's results and cards only; null (the default) reads exactly
  what the function did before. The 6-argument version is dropped so
  PostgREST sees one candidate, and its grants are restored. Apply the
  migration before deploying the web.
- loadShoppingOverview passes the market's regions only while the market
  filter applies (All regions picked), the same rule as the card reads.
  Reports call without it and are unchanged.

Behaviour kept from the switch:
- A brand opens on Europe only when every country is European; DE + TR
  gets no market, no switch and no claim.
- Both markets are offered once a brand has one.
- While a market applies, ChatGPT cards from other countries show only
  through the region filter.
- The switch shows with shopping mode off, paused prompts count as the
  brand's countries, brands.region is not read, and a ChatGPT card with
  no region is left out under a market.
@gkhngyk gkhngyk added enhancement New feature or request e-commerce Shopping, product catalog, store and marketplace connectors labels Oct 24, 2026
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Oct 24, 2026
@gkhngyk
gkhngyk merged commit ca7ad1e into main Oct 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e-commerce Shopping, product catalog, store and marketplace connectors enhancement New feature or request needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(shopping): a US / Europe market switch for AI shopping, with ChatGPT's source per market

1 participant