{"id":39486444,"url":"https://github.com/vtex-apps/add-to-cart-button","last_synced_at":"2026-01-18T05:26:54.145Z","repository":{"id":42173471,"uuid":"219743641","full_name":"vtex-apps/add-to-cart-button","owner":"vtex-apps","description":"A button for adding items into the shopping cart","archived":false,"fork":false,"pushed_at":"2026-01-14T17:28:41.000Z","size":668,"stargazers_count":6,"open_issues_count":7,"forks_count":34,"subscribers_count":39,"default_branch":"master","last_synced_at":"2026-01-14T21:31:33.119Z","etag":null,"topics":["hacktoberfest","store-framework","vtex-io"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vtex-apps.png","metadata":{"files":{"readme":"docs/README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-11-05T12:48:19.000Z","updated_at":"2026-01-14T17:28:44.000Z","dependencies_parsed_at":"2024-11-14T19:25:38.095Z","dependency_job_id":"e95c9075-6870-48a8-9ab1-7e77d0a66098","html_url":"https://github.com/vtex-apps/add-to-cart-button","commit_stats":null,"previous_names":[],"tags_count":67,"template":false,"template_full_name":"vtex-apps/react-app-template","purl":"pkg:github/vtex-apps/add-to-cart-button","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex-apps%2Fadd-to-cart-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex-apps%2Fadd-to-cart-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex-apps%2Fadd-to-cart-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex-apps%2Fadd-to-cart-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vtex-apps","download_url":"https://codeload.github.com/vtex-apps/add-to-cart-button/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vtex-apps%2Fadd-to-cart-button/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28530810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","store-framework","vtex-io"],"created_at":"2026-01-18T05:26:51.863Z","updated_at":"2026-01-18T05:26:54.126Z","avatar_url":"https://github.com/vtex-apps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"📢 Use this project, [contribute](https://github.com/vtex-apps/add-to-cart-button) to it or open issues to help evolve it using [Store Discussion](https://github.com/vtex-apps/store-discussion). \n\n# Add To Cart Button\n\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\nThe `add-to-cart-button` block is designed to add products to the [Minicart](https://developers.vtex.com/docs/apps/vtex.minicart/) (`minicart.v2`).\n\n![image](https://cdn.jsdelivr.net/gh/vtexdocs/dev-portal-content@main/images/vtex-add-to-cart-button-0.png)\n\n\u003e ⚠️ The **Add to Cart** button is only compatible with stores using Minicart v2. For these stores, it will function correctly on the Shelf component and the Product Details page. If you are using [Minicart v1](https://github.com/vtex-apps/minicart/blob/383d7bbd3295f06d1b5854a0add561a872e1515c/docs/README.md), you should configure the [Buy Button block](https://developers.vtex.com/docs/apps/vtex.store-components/buybutton) on the Product Details page and the [Product Summary Buy button](https://developers.vtex.com/docs/apps/vtex.product-summary/productsummarybuybutton) on the Shelf component instead.\n\n## Configuration\n\n1. Import the `vtex.add-to-cart-button` app to your theme dependencies in the `manifest.json` file, as follows:\n\n```json\n\"dependencies\": {\n  \"vtex.add-to-cart-button\": \"0.x\"\n}\n```\n\n2. Add the `add-to-cart-button` to another theme block using the product context, such as the `product-summary.shelf`. In the example below, the `add-to-cart-button` is added to the `flex-layout.row` block from the `store.product` template, which uses the product context:\n\n```json\n  \"store.product\": {\n    \"children\": [\n      \"flex-layout.row#product\",\n    ]\n  },\n  \"flex-layout.row#product\": {\n    \"children\": [\n      \"add-to-cart-button\"\n    ]\n  }\n```\n\n| Prop name | Type | Description | Default value |\n| - | - | - | - |\n| `onClickBehavior` | `enum` | Controls what happens when users click the button. Possible values are: `go-to-product-page`, `add-to-cart`, `ensure-sku-selection` (if multiple SKUs are available, users will be redirected to the product page to select the desired one. If the product only has 1 SKU available, it will be automatically added to the cart when the button is clicked) and `add-to-cart-and-trigger-shipping-modal` (opens a modal for ZIP code input if none is provided; otherwise, it adds the item to the cart. See more in [vtex.shipping-option-components](https://github.com/vtex-apps/shipping-option-components)). | `add-to-cart` |\n| `onClickEventPropagation` | `enum` | Controls whether the 'onClick' event, triggered upon user clicks, should propagate to the parent elements of the page. Possible values are: `disabled` and `enabled`. | `disabled` |\n| `isOneClickBuy` | `boolean` | Determines whether the user should be redirected to the checkout page (`true`) or not (`false`) when the **Add to Cart** button is clicked. | `false` |\n| `customOneClickBuyLink`   | `string`  | Defines the link to which users will be redirected when the **Add to Cart** button is clicked, and the `isOneClickBuy` prop is set to `true`. | `/checkout/#/cart` |\n| `customToastUrl` | `string`  | Defines the link to which users will be redirected when the toast (pop-up notification displayed when adding an item to the minicart) is clicked. | `/checkout/#/cart` |\n| `text` | `string`  | Defines a custom text message to be displayed on the **Add to Cart** button. | `Add to cart` _(automatic translation will be applied following your store default language)_ |\n| `unavailableText` | `string`  | Defines a custom text message to be displayed on the **Add to Cart** button when a product is unavailable. | `Unavailable` _(automatic translation will be applied following your store default language)_ |\n| `customPixelEventId` | `string`  | Defines the `id` for the event that the button will send upon user interaction.                                                                                                                                                                                                                                                                                   | `undefined` |\n\n## Customization\n\nTo apply CSS customizations to this and other blocks, follow the instructions in [Using CSS Handles for store customization](https://developers.vtex.com/docs/guides/vtex-io-documentation-using-css-handles-for-store-customization).\n\n| CSS Handles           |\n| --------------------- |\n| `buttonText`          |\n| `buttonDataContainer` |\n| `tooltipLabelText`    |\n\n\u003c!-- DOCS-IGNORE:start --\u003e\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/JNussens\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/7662734?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJean Nussenzveig\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/vtex-apps/add-to-cart-button/commits?author=JNussens\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://ygorneves.com\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/39542011?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eYgor Neves\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/vtex-apps/add-to-cart-button/commits?author=ygorneves10\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/lucaspacheco-acct\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/59736416?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLucas Pacheco\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/vtex-apps/add-to-cart-button/commits?author=lucaspacheco-acct\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind are welcome!\n\n\u003c!-- DOCS-IGNORE:end --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex-apps%2Fadd-to-cart-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvtex-apps%2Fadd-to-cart-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvtex-apps%2Fadd-to-cart-button/lists"}