Skip to content

Adding your own code (CSS, JavaScript)

When you want to tweak the look or behavior with code, there are three places to put it. Where you write it changes what happens when the theme is updated. The recommended order is top to bottom.

PlaceWhat you can writeOn / offWhen the theme is updated
1. “Custom CSS” in theme settingsCSSClear the fieldKept as-is (managed by Shopify outside the theme)
2. Custom Liquid (section / block)HTML, CSS, JavaScriptHide or remove the sectionKept as-is (saved as template settings)
3. Edit codeAnythingUntil you undo itFiles you added are kept. Editing existing files means the update has to reconcile your changes with the new version

1. “Custom CSS” in theme settings — start here

Section titled “1. “Custom CSS” in theme settings — start here”

Open the theme editor, click the gear (theme settings) at the top left, and scroll to “Custom CSS” at the bottom. If you only need CSS, use this first.

  • It never edits theme files, so a theme update never removes it
  • Saved per theme; clearing the field restores the original
  • Write selectors against the theme’s classes (e.g. .card__heading { letter-spacing: 0.05em; })

2. Custom Liquid — when you need HTML or JavaScript

Section titled “2. Custom Liquid — when you need HTML or JavaScript”

The “Custom Liquid” section (in Japanese, the section name is “カスタマイズされたLiquid” and the Add-section list shows “カスタムLiquid”) and the “Custom Liquid” block inside the product information (shown in Japanese as “カスタム Liquid”) both do this. You can write <style>, <script>, and HTML directly.

  • Place it anywhere on a page; hide the section to turn it off, delete it to remove it
  • Saved as template settings, so a theme update carries it over unchanged
  • Liquid works too, so you can render things based on theme settings or product data

Online Store → … (menu) → Edit code opens the theme files. Adding a new file (for example, create assets/my-shop.css and load it from a snippet) is preserved as your own file across updates.

What to avoid is editing the theme’s existing files (base.css, theme.liquid, and so on). When an update changes the same file you edited, we have to ask which side wins, and hard-to-review edits can delay the update.

  • Keep a list of the files you changed and what you changed
  • Send that list when you request a theme update; your edits get carried onto the new version first

Q. My added JavaScript conflicts with an app A Custom Liquid <script> loads as part of the page. If ordering against an app embed matters, add defer or adjust the load position in the app’s settings.

Q. Doesn’t the theme have a dedicated custom.css file like older themes did No. “Custom CSS” in theme settings serves the same purpose in a form that never interferes with theme updates.