Loading...
Loading...
Apply when deciding, designing, or implementing FastStore component overrides in src/components/overrides/. Covers getOverriddenSection API, component replacement, props overriding, and custom section creation. Use for any FastStore storefront customization beyond theming that requires changing component behavior or structure.
npx skill4agent add vtexdocs/ai-skills faststore-overridessrc/components/overrides/faststore-themingfaststore-state-managementfaststore-data-fetchingcomponents{ Component: CustomComponent }components{ props: { ... } }classNamegetOverriddenSection()__experimentalgetOverriddenSection()@faststore/corenode_modules/@faststore/node_modulesnpm install@faststore/core/src/@faststore/core/src/@faststore/core@faststore/core/experimentalnode_modules/@faststore/// src/components/overrides/ProductDetails.tsx
import { getOverriddenSection } from '@faststore/core'
import { ProductDetailsSection } from '@faststore/core'
import CustomProductTitle from '../CustomProductTitle'
const OverriddenProductDetails = getOverriddenSection({
Section: ProductDetailsSection,
components: {
ProductTitle: { Component: CustomProductTitle },
},
})
export default OverriddenProductDetails// WRONG: Importing from internal source paths
import { ProductDetails } from '@faststore/core/src/components/sections/ProductDetails'
// This path is an implementation detail that can change without notice.
// It bypasses the public API and will break on FastStore updates.
// WRONG: Modifying node_modules directly
// Editing node_modules/@faststore/core/dist/components/ProductDetails.js
// Changes are lost on every npm install and cannot be version-controlled.src/components/overrides/ProductDetails.tsxsrc/components/overrides/getOverriddenSectionsrc/components/overrides/// src/components/overrides/Alert.tsx
// File is in the correct directory and named after the Alert section
import { getOverriddenSection } from '@faststore/core'
import { AlertSection } from '@faststore/core'
import CustomIcon from '../CustomIcon'
const OverriddenAlert = getOverriddenSection({
Section: AlertSection,
components: {
Icon: { Component: CustomIcon },
},
})
export default OverriddenAlert// src/components/MyCustomAlert.tsx
// WRONG: File is NOT in src/components/overrides/
// FastStore will NOT discover this override.
// The native Alert section will render unchanged.
import { getOverriddenSection } from '@faststore/core'
import { AlertSection } from '@faststore/core'
const OverriddenAlert = getOverriddenSection({
Section: AlertSection,
components: {
Icon: { Component: CustomIcon },
},
})
export default OverriddenAlert__experimental__experimentalcomponents__experimental// src/components/overrides/ProductDetails.tsx
// ProductTitle is a documented overridable component of ProductDetails section
import { getOverriddenSection } from '@faststore/core'
import { ProductDetailsSection } from '@faststore/core'
const OverriddenProductDetails = getOverriddenSection({
Section: ProductDetailsSection,
components: {
ProductTitle: {
props: {
refNumber: true,
showDiscountBadge: false,
},
},
},
})
export default OverriddenProductDetails// src/components/overrides/ProductDetails.tsx
// "InternalPriceCalculator" is NOT a documented overridable component
import { getOverriddenSection } from '@faststore/core'
import { ProductDetailsSection } from '@faststore/core'
const OverriddenProductDetails = getOverriddenSection({
Section: ProductDetailsSection,
components: {
// This component name does not exist in the overridable list.
// The override will be silently ignored.
InternalPriceCalculator: { Component: MyPriceCalculator },
},
})
export default OverriddenProductDetailssrc/
├── components/
│ ├── overrides/
│ │ ├── ProductDetails.tsx ← override file (named after section)
│ │ ├── Alert.tsx
│ │ └── simple-alert.module.scss
│ ├── CustomBuyButton.tsx ← custom component
│ └── BoldIcon.tsx// src/components/overrides/ProductDetails.tsx
import { getOverriddenSection } from '@faststore/core'
import { ProductDetailsSection } from '@faststore/core'
import CustomBuyButton from '../CustomBuyButton'
const OverriddenProductDetails = getOverriddenSection({
Section: ProductDetailsSection,
components: {
BuyButton: { Component: CustomBuyButton },
},
})
export default OverriddenProductDetails// src/components/overrides/ProductDetails.tsx
import { getOverriddenSection } from '@faststore/core'
import { ProductDetailsSection } from '@faststore/core'
const OverriddenProductDetails = getOverriddenSection({
Section: ProductDetailsSection,
components: {
BuyButton: {
props: {
size: 'small',
iconPosition: 'left',
},
},
},
})
export default OverriddenProductDetails// src/components/overrides/Alert.tsx
import { getOverriddenSection } from '@faststore/core'
import { AlertSection } from '@faststore/core'
import styles from './simple-alert.module.scss'
import BoldIcon from '../BoldIcon'
const OverriddenAlert = getOverriddenSection({
Section: AlertSection,
className: styles.simpleAlert,
components: {
Icon: { Component: BoldIcon },
},
})
export default OverriddenAlertnode_modules/@faststore/patch-package!importantgetOverriddenSection()src/components/overrides/src/components/overrides/getOverriddenSection()@faststore/core@faststore/core@faststore/core/experimentalfaststore-theming