Skip to content

feat(apps-shopify): sync with deco-cx/apps shopify (i18n, cart recovery, listAllCategories) - #626

Merged
aka-sacci-ccr merged 1 commit into
mainfrom
feat/apps-shopify-sync-deno
Oct 6, 2026
Merged

aka-sacci-ccr merged 1 commit into
mainfrom
feat/apps-shopify-sync-deno

Conversation

@aka-sacci-ccr

@aka-sacci-ccr aka-sacci-ccr commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Why

@decocms/apps-shopify was ported from apps-start on 2026-07-07 and has not followed deco-cx/apps shopify/ since. This PR brings it up to date with deco-cx/apps@7147febe (2026-10-05). It matters for the Zee.Dog international stores, which need per-market prices and languages.

What changed (with the upstream PR it comes from)

Area Upstream Change
i18n #1371 languageCode / countryCode props on PDP, PLP, ProductList, RelatedProducts and shop. getCart / createCart take an optional third arg with the same fields. All of them reach Shopify through @inContext.
PDP slug #1371 parseProductSlug: only a 10–16 digit tail counts as a variant id. Before, t-shirt-2 was read as handle t-shirt with variant 2.
PLP #1371 The collection handle comes from the last non-empty path segment, so /{lang}/collections/<handle> works. The breadcrumb gets @id = collection id.
Cart #1371, #1610 If the cookie points to a cart Shopify returns NOT_FOUND for, a new cart is created instead of failing. buyerIdentity { countryCode email } is added to the Cart fragment and userErrors to CreateCart.
Metafields #1371 List-reference images are now joined with , and empty ones are dropped. If there are no images, the raw value is used. Before, this was a JSON array string that could contain nulls.
Collections #1371 onlineStoreUrl is added to the Collection fragment.
Categories #1639 New shopify/loaders/categories/listAllCategories loader, also exported as listAllCategoriesLoader.
Cache #1601 cache = "no-store" on the cart and user loaders.
API #1371 Storefront API 2025-04 → 2026-04.

Supporting change: the GraphQL client now throws ShopifyGraphQLError, which keeps the errors array (including extensions.code). The message is the same as before.

Intentional differences from upstream

  • No PT/BR default. Upstream defaults to languageCode: "PT" and countryCode: "BR". Here, leaving the props out omits the @inContext variables, so Shopify falls back to the store's primary market. That is the current behavior, so existing sites see no change. Adding a BR default would quietly switch non-BR stores to BRL prices.
  • Admin-token blocks are not ported (loaders/config, actions/order/draftOrderCalculate, adminAccessToken). Upstream #1675 marks them defaultVisibility: "private", and the blocks runtime has no equivalent yet. Porting them now would expose an action backed by the admin token through invoke. This should be a separate PR once visibility is supported.
  • Not applicable to this package: loaders/proxy (skipped in SKIP_RESOLVE_TYPES), handlers/sitemap (covered by @decocms/blocks/sdk/sitemap), hooks/* (site-level), and the cart cookie encoding fix (utils/cookies already encodes and decodes).

Tests

  • bun run typecheck ✅ · bun run test ✅ (44 tests, 8 new) · biome lint ✅
  • New tests: parseProductSlug, how metafield reference values are resolved, getCart replacing a stale cart while passing the language/country through, and getCart rethrowing errors other than NOT_FOUND.
  • knip reports vitest/tsc as unlisted, which is the same on main and not caused by this PR.
  • The files use tabs, like the rest of apps-shopify, even though the root biome.json says spaces. The diff contains only real changes.

🤖 Generated with Claude Code


Summary by cubic

Brings @decocms/apps-shopify up to date with the deco-cx/apps shopify package (as of 2026-10-05) for the Zee.Dog international stores, which need per-market prices and languages. Adds optional language and country context to the product, shop, and cart loaders, recovers from stale carts, and adds a categories loader; all 44 tests, typecheck, and lint pass.

Key changes

  • Added languageCode/countryCode props to PDP, PLP, ProductList, RelatedProducts, shop, and the cart loaders.
  • getCart creates a new cart when the cookie references one Shopify returns NOT_FOUND for, instead of failing.
  • parseProductSlug only counts a 10–16 digit numeric tail as a variant id, so handles like t-shirt-2 stay intact.
  • PLP resolves the collection handle from the last non-empty path segment and adds the collection id to the breadcrumb @id.
  • List-reference metafield images are comma-joined with empty entries dropped, falling back to the raw value.
  • New shopify/loaders/categories/listAllCategories loader, exported as listAllCategoriesLoader.
  • Cart and user loaders use cache = "no-store".
  • Storefront API bumped from 2025-04 to 2026-04; the GraphQL client now throws ShopifyGraphQLError, preserving the errors array including extensions.code.

Intentional differences from upstream

  • Omitting language/country omits the @inContext variables, so Shopify falls back to the store's primary market; no PT/BR default that would switch non-BR stores to BRL prices.
  • Admin-token blocks (loaders/config, actions/order/draftOrderCalculate, adminAccessToken) are not ported; they need private-visibility support the blocks runtime lacks.
  • Not applicable here: loaders/proxy, handlers/sitemap, hooks/*, and the cart cookie encoding fix (already handled).

Written for commit 188e487. Summary will update on new commits.

Review in cubic Turn on auto-fix

…ry, listAllCategories)

Brings @decocms/apps-shopify up to date with deco-cx/apps shopify/ as of
7147febe (2026-10-05):

- i18n (#1371): optional languageCode/countryCode on PDP, PLP, ProductList,
  RelatedProducts, shop and cart, sent through @incontext
- parseProductSlug: only a 10-16 digit tail counts as a variant id
- PLP: collection handle from the last path segment, breadcrumb @id
- cart: replace a NOT_FOUND cart instead of failing; buyerIdentity and
  userErrors on the cart queries
- metafields: list reference images comma-joined, raw value fallback
- listAllCategories loader (#1639)
- no-store on cart/user loaders (#1601)
- Storefront API 2025-04 -> 2026-04

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@aka-sacci-ccr
aka-sacci-ccr requested a review from a team October 6, 2026 17:05
@aka-sacci-ccr
aka-sacci-ccr merged commit b525b53 into main Oct 6, 2026
1 check passed
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 7.73.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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