Beauty Affairs HK

Legacy and unused code

What is unused, what looks unused but is not, and how to check before deleting or extending a file.

Read this before deleting anything, and before extending a file whose name you do not recognise.

The theme still holds code from many apps the store has removed, and from two redesigns. A file's presence in the repository does not show that the store uses it.

How to tell whether something is in use

For a section, check whether any JSON template references its type:

grep -rl '"type": *"my-section"' templates/

If the section has a presets block, a merchant can still add it in the theme editor even when no template references it. Check for one.

For a snippet, search for renders:

grep -rn "render 'my-snippet'\|include 'my-snippet'" sections snippets layout templates

Theme Check reports snippets nothing renders as OrphanedSnippet. There are currently 222 of them.

For a template, check whether any product, page or collection uses that template suffix. Only pages whose template is set to faq in admin use page.faq.liquid, and the repository cannot show you that. Check in Shopify admin before deleting a template.

For an entrypoint, see Entrypoints. It lists every file that no Liquid renders and says why.

Confirmed unused

Reading the code confirms these files are unused.

FileEvidence
src/entrypoints/counter.tsDemo from the project template. No Liquid renders it and nothing imports it. It carries its own usage example in a comment
src/components/counter/index.tsOnly counter.ts imports it
src/entrypoints/main.tsContains one line, the Vite modulepreload polyfill import. Nothing renders it
src/entrypoints/quick-add-modal.cssAppears only in the generated vite-tag.liquid. No Liquid renders it
src/components/popup-logic/definitions/global-popup.tsIts import in src/entrypoints/popup-logic.ts is commented out
src/components/popup-logic/definitions/cash-vouchers.tsNothing imports it
src/components/popup-logic/definitions/street-sale.tsNothing imports it

The global popup matters to store staff. Its section and theme settings still appear in the theme editor, so a merchant can edit them and see no effect. See Operations: popups.

Unused settings and data

ItemEvidence
custom.max_allowed_popups metafieldLiquid writes it to window.theme.popupManagerConfig, but no script reads it
Global popup section and theme settingsThe global-popup definition is not registered, so the storefront never shows the popup they set up

Kept on purpose, do not delete

FileWhy
src/entrypoints/mini-cart/elements/00-example.tsA template to copy when adding a mini-cart element. The 00- prefix sorts it first
src/entrypoints/mini-cart/internals/*The elements import these files and no Liquid renders them. Vite emits each as its own chunk
src/entrypoints/utils.tsA shared module kept in the entrypoints directory for historical reasons. The booking calendar and a mini-cart rule import it
The Australian metafield lookup in snippets/medispa-calendar-config.liquidHong Kong has no custom.medispa_landing_page metafield, but the lookup stays first so the two stores' code can still be merged

App code still in the theme

These counts come from filenames. Check an app's status in Settings > Apps and sales channels before treating its code as unused, because some of these apps are still installed.

App markerTemplatesSectionsSnippets
sca (Secomapp)902
maestrooo600
discountninja (Limoni)2011
limoniapps0011
hulkapps007
swym205
hs-105
boost-pfs313
tolstoy030
haloroar100
yotpo010
reputon010

The maestrooo templates are the search templates from Prestige, the theme this one started from.

layouthub appears only inside the locale files, not in any filename. It causes a large share of the translation errors described below.

The Theme Check baseline

shopify theme check currently reports 4,218 offences across 318 of 522 files, made up of 2,982 errors and 1,236 warnings. That count describes the theme as it was when these docs were written. A recent change did not cause it.

RuleCountWhat it mostly is
MatchingTranslations2,817Keys in fr, he, ja, ko, zh-CN and zh-TW with no entry in en.default.json, largely from the removed LayoutHub app
VariableName420Naming style in older Liquid
DeprecatedFilter236Liquid filters Shopify has replaced
OrphanedSnippet222Snippets nothing renders
UnusedAssign94Liquid assignments nothing reads
RemoteAsset69Assets loaded from another domain
ImgWidthAndHeight68Images without dimensions, which cause layout shift
UndefinedObject59Liquid objects referenced but not in scope
LiquidSyntaxError31Mostly in app snippets
TranslationKeyExists24Duplicate keys in en.default.json
LiquidHTMLSyntaxError16Malformed markup
ParserBlockingScript13Scripts without defer or async
MissingAsset10References to files not in assets/
ValidJSON1An invalid setting type in config/settings_schema.json

Do not try to clear this list. Check that your change adds no offence of a type that was not already present. When you are already editing a file, fix its ValidJSON and ImgWidthAndHeight errors.

Theme settings describes the single ValidJSON error.

Schemas that are not strict JSON

Four section schemas contain trailing commas. Shopify accepts them and Theme Check does not report them, but any tool that uses a standard JSON parser fails on them:

  • sections/medispa-service-callout.liquid
  • sections/review-carousel.liquid
  • sections/blog-posts-redesign.liquid
  • sections/seo-content-redesign.liquid

Do not add more.

Deleting safely

  1. Confirm nothing references the file, using the checks at the top of this page.
  2. For a template, confirm in Shopify admin that no product, page or collection uses that suffix.
  3. Delete on a branch and push to an unpublished theme, never straight to the live theme.
  4. Check the affected pages on the preview.
  5. Put the deletion in its own commit, so you can revert it on its own.

If you delete a template that a product or page still uses, Shopify falls back to the default template. The page usually looks broken and no error appears. This is the most common way a deletion goes wrong.

On this page