Skip to Content

B2C Doctor

Find dead code in SFCC cartridges from VS Code. Unused scripts, templates, functions, routes, resource keys, hooks and metadata, why each is dead, and one Undo to remove it

B2C Doctor finds what nothing in your linked cartridges uses: files, functions, variables, requires, exports, commented-out code, routes, resource keys, custom hooks and tags, custom attributes and object types. It says why each one is dead and whether it is safe to remove, removes a selection at once with Undo to put it back, and lists the errors the scan, your editors and Log Center find

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it

Why use it

  • Old code stays forever. Overrides, retired integrations and copied cartridges leave files nobody dares to delete. B2C Doctor proves what is unused
  • It tells safe from risky. Ready to remove means nothing uses it. Check first means something might: a name built at run time, a route a payment provider calls, a file the server logs show running
  • It explains every finding. Each one says why it counts as dead and what to do, next to its code
  • Removal is one step back. Everything you remove goes at once, and Undo puts it all back
  • It stays current. It scans again as you edit while its tab is open, and script editors fade what it finds
  • Same answer for every site. It reads every linked cartridge, never one site's cartridge path

Open it

Click Open B2C Doctor in the title bar of the Cartridges view, or run Intellij SFCC: Open B2C Doctor from the Command Palette. It opens as an editor tab. The first scan shows its steps, and you keep working meanwhile

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it

Overview

The Overview sums up the last scan in four numbers: the findings, what is ready to remove, what to check first and the errors. Under them, how many files it read and how long it took

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it
PartWhat it shows
Ready to removeNothing in the linked cartridges uses them
Check firstCode may build their names, links may call the routes, the server logs show them running, or removing them does more
By typeThe types with findings, in four groups: Files nothing uses, Inside live files, Hooks, tags and resource keys and Site metadata, with each one's share of what the scan read, such as 1% of 412. The types with none share one line under them
ErrorsThe errors per source, then the errors from the server logs
By cartridgeThe findings per cartridge, then Site metadata
Live files with the most unused codeWhere cleaning up pays most

Click a line to open Findings on that type, cartridge or file, or Errors on that source. The findings and errors numbers open their pages

Findings

The Findings page lists every finding in a tree, and the details of the selected one beside it: why it counts as dead, what to do, and its code

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it
SectionWhat it lists
Server scriptsScripts no controller, hook, job step, pipeline or live script requires, imports or names
ISML templatesTemplates nothing renders, includes or names
Form definitionsForms no code names, whatever locale folder their copies are in
JSON filesJSON no live script requires and no code or site data names
Unused codeFunctions, variables, requires and exports nothing reads, inside live scripts
Commented-out codeComments that hold code, not words
Unused routesController routes nothing links to
Resource keysKeys no live script, template or form reads. A key counts in every locale file of its bundle
Custom hooksHooks no live code calls by name, so their scripts never run
Custom tags<ismodule> tags no live template uses
Custom attributesAttributes no script, template or form reads
Custom object typesTypes no script or template names

A file only other dead files use is dead too. Removing an unused function also lists what only it uses. Previous and Next step through the findings, Open in Editor opens the code, and Ignore keeps a finding out of the list. Right-click a row for Open, Remove..., Ignore, Reveal in Explorer View and Copy Path

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it
  • View Options groups the tree by type or by cartridge
  • Show hides dead files or metadata, or shows the findings you ignored
  • Search dead code narrows the tree by name or path, and the status line counts what it shows

Remove dead code

Select findings, a file or a whole section and click Remove.... The dialog lists what goes, and a file the server logs show running starts unticked

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it
  • Everything goes at once. Undo in the notification or the toolbar puts it all back, and files you had not changed are saved
  • A resource key goes from every locale file of its bundle, in every cartridge
  • Custom attributes and object types change in your metadata files only. Business Manager keeps them until you import the files
  • A file that changed since the scan, or is read only, is kept

Errors

The Errors page lists the error-level problems in the files B2C Doctor reads: its own syntax check, then what your editors report for those files. Click one to open its line in an editor beside the tab

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it

Seen in server logs adds the errors Log Center found on your instance, at the lines they name in your cartridges. It reads what Log Center already has, so it costs no extra requests

In the editor

Script editors fade unused requires, functions, variables and exports, and a lens above the first line counts them, with Show in B2C Doctor, Remove All in This File... and Ignore All in This File. Hover a faded name to see why it is dead

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it
  • The light bulb, or Quick Fix... (⌘ . on macOS, Ctrl . on Windows and Linux), offers Remove with B2C Doctor..., which opens the Remove dialog on that finding, and Ignore in B2C Doctor
  • A dead file shows its reason in the lens, with Show in B2C Doctor, Remove... and Ignore
  • Commented-out code, unread resource keys, unused hooks and tags, and unused custom object types fade in their files too
  • The marks are faint hints, never problems. They show a few seconds after VS Code starts, even before you open the tab, and follow the report as it changes

Share the Overview

Share… in the Overview toolbar opens a preview of the Overview as an image: a dark card with your project name as its title, the four numbers, the top types and cartridges, and the Intellij SFCC and B2C Doctor marks. Type the name you want on it, since the workspace name is often a folder name; the name is kept for the project. Then Copy Image or Save as PNG…, ready for a ticket or a team chat

B2C Doctor finds the files, code, routes, resource keys, hooks, tags and metadata nothing in your linked cartridges uses, says why and what is safe to remove, and removes it at once with Undo to put it back. Script editors fade the unused code and offer a quick fix to remove it

With agents

B2C MCP gives AI agents the same scan in two tools. Agents read the counts first and fetch only the findings they need, so a cleanup costs few tokens

ToolWhat it does
sfcc_dead_codeCounts first: what is ready to remove and what to check first, by type and cartridge. groupBy counts per type, cartridge, folder or file, as View Options groups the tab. Then short pages of findings by type, cartridge, path or a search, each with an ID the remove plan takes. detail: full adds why each one is dead and its code. It also lists the error-level problems
sfcc_dead_code_remove_planPlans removing the findings an agent names, or every ready one that matches. sfcc_mutation_execute removes them at once after you confirm in VS Code, and Undo in B2C Doctor puts it all back

Ask "Which cartridge has the most dead code?", "Find dead code in app_custom/cartridge/scripts" or "Remove the unused scripts". The agent leaves findings to check first alone unless you name them, and ignored findings stay out. Agents plan removals under the Plan profile and run them under Full. See Tools & Access

What it leaves alone

  • Custom APIs under a cartridge's rest-apis folder: storefront apps call them from outside the cartridges
  • Platform routes the server calls by itself
  • Nothing changes when you switch sites: decisions use every linked cartridge

License

B2C Doctor needs an active license or trial. See Purchase

On this page