Documentation
Feedback
Guides
Storefront Development

Storefront Development
FastStoreCustomizing sections and componentsSection override
Upgrading from Section Override v1 to v2
Section Override v2 allows you to customize the appearance and functionality of existing components in your store. Compared to v1, v2 offers an adaptable approach.
We strongly recommend using Section Override v2 in favor of Section Override v1.

Main differences

FeatureSection Override v1Section Override v2
Overrides per sectionOne override per section.Multiple overrides per section.
Importing SectionString passed to section key.Section component imported and passed to Section key (uppercase S).
Native sectionThe new component overrides the native one.The new component is based on the native one and can coexist with it.
Headless CMS property schemaNo customization, limited to native schemas.Customizable schema allowing definition of new properties.
Feature availabilityExperimental feature and may not function as expected.Stable feature.
Check out the main differences related to the code syntax:
  • In Section Override v1, a section is overridden by specifying the section name and component:

    _12
    import { SectionOverride } from "@faststore/core";
    _12
    _12
    const SECTION = "Alert" as const;
    _12
    _12
    const override: SectionOverride = {
    _12
    section: SECTION,
    _12
    components: {
    _12
    Alert: { Component: CustomAlert },
    _12
    },
    _12
    };
    _12
    _12
    export { override };

  • Section Override v2 introduces a more component-centric approach. It directly references the section component (e.g., AlertSection from @faststore/core) using a dedicated function (getOverriddenSection) and builds the override object around it, emphasizing the component being overridden. This shift in v2 promotes clearer code and offers more control during the override creation process.

    _10
    import { AlertSection, getOverriddenSection } from "@faststore/core";
    _10
    _10
    const NewAlert = getOverriddenSection({
    _10
    Section: AlertSection,
    _10
    components: {
    _10
    Alert: { Component: CustomAlert },
    _10
    },
    _10
    });
    _10
    _10
    export default NewAlert;

Updating your project to Section Override v2

Make sure your store's @faststore/core package is version 3.0.0 or higher to work with Section Override v2. For update instructions, refer to the release note.

Identify existing overrides (v1)

Identify all overrides currently implemented using Section Override v1. Once identified, adjust your code to use Section Override v2.
We strongly recommend using Section Override v2 instead of Section Override v1.
Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page