Skip to Content

B2C Doctor

Find dead code in SFCC cartridges. 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 as one command that Undo takes back, and lists the errors your inspections and server logs 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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP

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 as one command, so one Undo restores it
  • It stays current. It scans again as you edit, and script editors gray out what it finds
  • Same answer for every site. It reads every linked cartridge, never one site's cartridge path

Open it

Click B2C Doctor on the right tool window bar, or pick it from the toolbar's More menu. 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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP
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 inspection, 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 inspection. 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 with the unused parts grayed out

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP
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, Remove All in This File... clears a file at once, and Ignore keeps a finding out of the list

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP
  • View Options groups the tree by type or by cartridge, A to Z
  • Show hides kinds of findings, or shows the ones you ignored
  • Search dead code narrows the tree by name or path

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP
  • Everything goes as one command. Undo takes it back, and Local History keeps a label from before
  • 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 what the plugin's inspections find at error level, such as a template no cartridge has or a site preference your metadata does not define. Select one to see it in 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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP

Seen in server logs adds the errors Log Center found on your instance, at the lines they name in your cartridges. Double-click one to open it in Log Center. It needs a Log Center tab open on an instance, and reads what Log Center already has, so it costs no extra requests

In the editor

Script editors gray out unused requires, functions, variables and exports. A dead file shows a banner with Show in B2C Doctor and Ignore All in This File. Commented-out code, unread resource keys, unused hooks and tags are grayed in their files too

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP

The report follows your edits: start using a file and its banner goes, with no rescan

Share the Overview

Share 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 IDE's project name is often a folder name; the name is kept for the project. Then copy the image or save it as a 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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP

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

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 as one command that Undo takes back. Its Errors page lists what the inspections and the server logs find, and agents get the same scan over B2C MCP
ToolWhat it does
intellijsfcc_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 window. Then short pages of findings by type, cartridge, folder, file or a search, each named by an ID such as file:app_custom/scripts/helpers/oldHelper.js. detail: full adds why each one is dead and its code. It also lists the error-level problems
intellijsfcc_dead_code_remove_planPlans removing the findings an agent names, or every ready one in a type, cartridge, folder or file. intellijsfcc_mutation_execute removes them as one command, and Edit → Undo restores it all

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 remove code only under SFCC full, or a Custom preset that runs plans. See Tools & Presets

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