How vtex-apps/add-to-cart-button works
Project type and purpose
• This is a front-end VTEX IO “block” (an add-to-cart-button) packaged as a React/TypeScript app.
• Its sole purpose is to render a configurable “Add to Cart” button on product shelves and detail pages, invoke VTEX Minicart v2 APIs, fire pixel events, and optionally redirect users (one-click buy).
File structure
• Top-level config files (.eslintrc, manifest.json, tsconfig.json in react/, store/) indicate a VTEX IO app setup.
• The react/ folder contains:
• Components (AddToCartButton.tsx, Wrapper.tsx)
• Hooks (useMarketingSessionParams.ts)
• Modules (pure functions for mapping catalog items, comparing objects, etc.)
• Tests (__tests__), mocks (__mocks__), and fixtures (__fixtures__) for unit testing and mocking VTEX services.
• The store/ folder holds JSON schemas (contentSchemas.json, interfaces.json) describing the block’s runtime props and data dependencies exposed to the VTEX Store Framework.
• manifest.json declares the block and its dependency on “minicart.v2” (checkout resources) and other VTEX render-runtime services.
Review of README for additional insights
• Describes block usage, configuration props, CSS handles, and compatibility with Minicart v2.
• Points to VTEX Store Framework for block composition and theming.