Cartridge path lookup order and override behavior
Key Takeaway
B2C Commerce searches the cartridge path from left to right and uses the first cartridge that has the file. A cartridge on the left therefore overrides the same file in a cartridge to its right, such as app_storefront_base.
A B2C Commerce storefront is built from several cartridges. The cartridge path is the ordered list of those cartridges. You set it for each site in Business Manager. When the same file exists in more than one cartridge, the order of names on the path decides which version runs.
Cartridges and the cartridge stack
A storefront needs at least one cartridge and usually has several. The site also needs at least one custom cartridge, or it has no branding of its own.
In a typical Storefront Reference Architecture (SFRA) stack, the layers from bottom to top are:
- Base:
app_storefront_base - Plug-in cartridges, for example
plugin_applepayorplugin_comparison - LINK cartridges for third-party integrations, for example
LINK_bazaarvoice - Custom cartridges for your brand and site
Base cartridges sit at the bottom of the stack and are loaded first. Custom cartridges are loaded last.
Name custom cartridges with an app_custom_ prefix so they are easy to tell apart from base, plug-in and LINK cartridges.
A separate cartridge for each brand or locale lets you reuse most of the stack for every storefront. You can then roll out general changes to all sites, or specific changes to only one or a few.