Skip to content

fix(storefront): Fix loyalty points not showing at checkout when store has discount preset - #804

Closed
vitorrgg wants to merge 2 commits into
mainfrom
fix/storefront-loyalty-points-preset-skip
Closed

fix(storefront): Fix loyalty points not showing at checkout when store has discount preset#804
vitorrgg wants to merge 2 commits into
mainfrom
fix/storefront-loyalty-points-preset-skip

Conversation

@vitorrgg

@vitorrgg vitorrgg commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Stores with discount_option or installments_option configured in modules settings (e.g. PIX discount) had modulesInfo.list_payments pre-populated from the preset on page load
  • fetchInfo was skipping the API call when any preset data existed, emitting only { discount_option } without ever fetching loyalty_points_programs from the loyalty app
  • waitStorefrontInfo('list_payments', 'loyalty_points_programs') in PointsApplier would never resolve, so the loyalty points toggle was never rendered in checkout

Root cause commit: a3ab982 — "Handle modules info watchers on checkout (vbeta app)"

Fix: always fetch from the API; emit preset/cached data immediately as an initial value for fast rendering while the API call completes.

Test plan

  • Store with PIX/discount configured in modules settings: confirm loyalty points toggle appears in checkout after selecting shipping
  • Store without discount preset: confirm existing behavior unchanged
  • Confirm window.storefront?.info?.list_payments?.loyalty_points_programs is populated after checkout load

🤖 Generated with Claude Code

@leomp12

leomp12 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Branch tá todo cagado viu

vitorrgg and others added 2 commits August 7, 2026 16:33
Porta o app Bling ERP (app_id 102418) do repositório app-bling-erp-v2 para
o monorepo, usando a API v3 do Bling: exportação de pedidos e produtos,
importação de estoque, pedidos e categorias, e renovação automática dos
tokens OAuth.

Funções: `blingerp-onStoreEvent` (eventos da loja), `blingerp-callback`
(callbacks de estoque/pedidos do Bling), `blingerp-authCallback` (fluxo de
autorização OAuth) e `blingerp-cronRefreshToken`.

A fila do app v1 em Firestore (`queue/{storeId}/events` + `running_events`)
foi substituída pelo PubSub de eventos do monorepo, e o `appSdk` multi-loja
pelo `@cloudcommerce/api`. Tokens ficam em `blingTokens/{storeId}` e o cache
de situações de venda em `blingStatuses/{storeId}`.

Correções sobre o comportamento do app v1:
- atualização de produto com variações falhava com 400 no Bling, porque as
  variações eram enviadas sem ID (a listagem `/produtos?codigo=` devolve o
  produto resumido);
- preço por variação era perdido na exportação (o Bling aplica o preço do
  produto pai), agora corrigido com PUT por variação divergente;
- callback de estoque de variação sem SKU no Bling era descartado, agora usa
  o ID do Bling como referência;
- configuração "Importar produto" não tinha efeito, pois o callback forçava
  `canCreateNew: false`;
- status "Devolvido" era enviado como fulfillment inválido;
- limite diário da API gravava a flag invertida, liberando novas chamadas;
- grades de variação importadas viram `size`/`age_group`/`gender` como no
  sentido inverso, em vez de slug do rótulo;
- sem situação correspondente no Bling, o pedido não falha mais: registra
  aviso e segue exportado.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…e has discount preset

When a store has discount_option or installments_option configured in modules settings,
modulesInfo[list_payments] was already non-empty from the preset, causing fetchInfo
to skip the API call entirely. As a result, loyalty_points_programs returned by the
loyalty app was never merged into storefront.info, so PointsApplier never received
the programs and the toggle was not rendered.

Fix: always fetch from the API, emitting preset data immediately as an initial value
for fast rendering while the API call completes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vitorrgg
vitorrgg force-pushed the fix/storefront-loyalty-points-preset-skip branch from f486478 to 009ffe5 Compare August 7, 2026 19:33
@vitorrgg vitorrgg closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants