loadStorefrontScript(brandingProfileID, styling, options)
The loadStorefrontScript
function is designed to dynamically load and execute specific storefront scripts and styles based on a
given group ID. It also allows us to update all storefronts at once when new features are added or existing ones are updated. Options that are
frequently requested can be set using the options parameter.
The identifier for the specific script group to be loaded. This determines which module and styles to import.
An optional object to customize the CSS variables used for styling different parts of the storefront. The properties include:
navbarBackground?: string
- Background color of the navbarnavbarTextColor?: string
- Text color in the navbarnavbarHoverColor?: string
- Text hover color in the navbarloginbarBackground?: string
- Background color of the login barloginbarTextColor?: string
- Text color in login barloginbarHoverColor?: string
- Text hover color of the login barprimaryBackground?: string
- Primary background colorprimaryTextColor?: string
- Primary text colorprimaryHoverColor?: string
- Primary text hover colorsecondaryBackground?: string
- Secondary background colorsecondaryTextColor?: string
- Secondary text colorsecondaryHoverColor?: string
- Secondary text hover colortagBrandBackground?: string
- Brand tag background colortagBrandText?: string
- Brand tag text colortagDecorationBackground?: string
- Decoration tag background colortagDecorationText?: string
- Decoration tag text colortagDimensionsBackground?: string
- Dimensions tag background colortagDimensionsText?: string
- Dimensions tag text colortagPackSizeBackground?: string
- Pack size tag background colortagPackSizeText?: string
- Pack size tag text colortagSkuBackground?: string
- SKU tag background colortagSkuText?: string
- SKU tag text colorAn optional object to customize various display options for the storefront. The properties include:
hideHomeLink?: boolean
- Hides "Home" link in the navbar (default: false)hideCompanyShipTo?: boolean
- Hides "Ship To Company" section on Shipping Address page (default: false)hideAddressBook?: boolean
- Hides Address Book and "Add to Address Book" button on Shipping Address page (default: false)
lockAddressBook?: boolean
- Makes Address Book read-only. Users cannot add their own addresses. (default: false)enableDropdown?: boolean
- When true, makes subcategories collapsable. (default: false)Here is an example of how to use the loadStorefrontScript
function:
<!-- You should include this script tag in the head of your HTML file. You can set this in the branding profile. -->
<script src="https://main--vividstorefronts.netlify.app/dist/main.js"></script>
const groupID = 66;
const styling = {
navbarBackground: '#333',
navbarTextColor: '#fff',
navbarHoverColor: '#555',
loginbarBackground: '#222',
loginbarTextColor: '#ccc',
loginbarHoverColor: '#444',
primaryBackground: '#f1f1f1',
primaryTextColor: '#000',
primaryHoverColor: '#ddd',
secondaryBackground: '#e1e1e1',
secondaryTextColor: '#111',
secondaryHoverColor: '#bbb',
};
const options = {
hideHomeLink: true,
hideCompanyShipTo: false,
hideAddressBook: false,
};
loadStorefrontScript(groupID, styling, options);