Custom CSS and code
Custom CSS and code for Split developers: custom fonts, extra product badges and header layout recipes. Krown support does not help with custom code.
Applies to: Split 5.1.0 and later. Added in: Split 1.0.0. Last checked: 2026-10-13 against Split 5.1.0.
Krown support does not provide help with custom code. This page is for developers: it collects CSS and Liquid recipes for changes that Split has no setting for, checked against the Split 5.1.0 files. For a change you cannot make yourself, see Custom work and code changes.
Where to find it: CSS goes into a section's Custom CSS in the theme editor. Code edits are made in Shopify admin → Online Store → Themes → … → Edit code.
Code edits to theme files are not always carried over when you update Split. Duplicate your theme before you edit it, and keep a copy of every change. See Update Split.
Where to add custom CSS
Split has no Custom CSS box in Theme settings. Use Shopify's own Custom CSS field of a section instead:
- In the theme editor, select the section, for example the Header in the Header group, and scroll to the bottom of its settings to Custom CSS.
- Shopify applies that CSS only to the section you added it to, so selectors must target elements inside that section.
- For CSS that has to apply to the whole store, add it to a stylesheet in the theme code (a code edit).
Adding your own font
Split uses two fonts from Shopify's font library: the heading font for titles (h1 to h6) and the body font for everything else, including the menu, buttons, inputs and selects. There is no separate menu font. To use a font that is not in the library, replace the font code in snippets/head-variables.liquid.
Upload the font files
Upload your font files in Shopify admin → Content → Files and copy the URL of each file. The woff2 format, or woff, works in every current browser.
Remove the font preload lines
Open snippets/head-variables.liquid. At the top (lines 1 to 12 in Split 5.1.0), delete the two assign lines and the two <link rel="preload" …> blocks that load the headings and body fonts:
{%- assign headings_font = settings.headings_font -%}
{%- assign body_font = settings.body_font -%}
{%- unless headings_font.system? -%}
<link rel="preload" href="{{ headings_font | font_url }}" as="font" type="font/woff2" crossorigin>
{%- endunless -%}
{%- unless body_font.system? -%}
<link rel="preload" href="{{ body_font | font_url }}" as="font" type="font/woff2" crossorigin>
{%- endunless -%}Replace the font-face code
Further down, inside the first <style> tag (about lines 79 to 97), find the Fonts comment and the Liquid block under it that holds the font_face lines (it starts with echo headings_font | font_face). Delete that whole Liquid block and paste one @font-face declaration per font file instead:
@font-face {
font-family: "MyFont";
src: url('Your_font_file_URL') format("woff2");
}
@font-face {
font-family: "MyFont";
font-weight: 700;
src: url('Your_bold_font_file_URL') format("woff2");
}
@font-face {
font-family: "MyFont";
font-weight: 400;
font-style: italic;
src: url('Your_italic_font_file_URL') format("woff2");
}Add a declaration for every weight and style you use, and one set per font if headings and body use different fonts.
Hard-code the font variables
Find the /* Font variables */ lines (about lines 146 to 159) and replace them with your font names:
/* Font variables */
--font-stack-headings: "MyFont", sans-serif;
--font-weight-headings: 400;
--font-style-headings: normal;
--font-stack-body: "MyFont", sans-serif;
--font-weight-body: 400;
--font-weight-body-bold: 700;
--font-style-body: normal;Check the store
Save the file and open your store. The Font family settings in Theme settings → Typography no longer change the fonts; the Base size and Line height settings still work.
Using a Google font
To use a font from Google Fonts, copy the <link> code Google gives you and paste it in layout/theme.liquid, just before the closing </head> tag. For example, for the Poiret One font:
<link href="https://fonts.googleapis.com/css?family=Poiret+One" rel="stylesheet">Then follow the steps above without the @font-face declarations: remove the preload lines and the font-face code, and write the Google font name in the font variables, for example --font-stack-headings: "Poiret One", sans-serif;.
Adding a product badge from a tag
Split shows four badges: Sold out, Sale, Pre Order (product tag preorder, pre order or Pre Order) and New (product tag new, lower case). To show another badge for a tag, add a condition to snippets/product-badges.liquid. The badge then shows in product cards and in the Product header block on the product page.
Open the badges snippet
In Edit code, open snippets/product-badges.liquid. The file name has a hyphen.
Add the condition
Find the New badge condition ({%- elsif product.tags contains 'new' -%}) and its <div>. Right after that </div>, before the {%- endif -%} on the next line, paste:
{%- elsif product.tags contains 'more options' -%}
<div class="product-badge new text-size--smaller"
style="background-color: {{ settings.product_card_badge_regular_background_color }}; color: {{ settings.product_card_badge_regular_text_color }}; border-color: {{ settings.product_card_badge_regular_border_color }}"
><span>more options</span></div>Replace both more options texts with your tag and your badge text.
Tag the products
Add the tag to each product that needs the badge, in Shopify admin → Products. The tag in the code and the tag on the product must match exactly, including upper and lower case.
The new badge uses the colors of Theme settings → Product card → Product badges (Background color, Text color, Border color), like the New and Pre Order badges.
The badge is part of the same condition as Pre Order and New, so a product shows only one of these three badges: Pre Order first, then New, then yours.
Centering the logo or the menu
Split has no setting to move the logo or the menu in the header. On screens wider than 1024 px, the header shows the logo on the left and, on the right, the classic menu (with Desktop menu style Classic), then the search, account, cart and menu icons. The CSS below goes into the Header section's Custom CSS.
Classic menu in the middle
With Desktop menu style Classic, this centers the menu in the space between the logo and the icons:
@media screen and (min-width: 1025px) {
.site-nav.style--classic {
flex: 1;
}
.site-nav.style--classic > .site-nav-container {
flex: 1;
justify-content: center;
}
}Logo in the center, classic menu on the left
With Desktop menu style Classic, this puts the logo in the middle of the header and the menu on the left. It works only with a short menu that fits in half of the screen:
@media screen and (min-width: 1025px) {
.site-header .logo {
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
.site-nav.style--classic {
flex: 1;
}
.site-nav.style--classic > .site-nav-container {
flex: 1;
}
}Logo in the center with the Drawer menu style
With Desktop menu style Drawer, this centers the logo and keeps the icons on the right:
@media screen and (min-width: 1025px) {
.site-header.desktop-view--minimal .logo {
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 1;
}
.site-header.desktop-view--minimal .site-nav.style--classic {
margin-inline-start: auto;
}
}When the classic menu is too wide for the header, Split replaces it with the menu icon automatically. A centered logo leaves less room for the menu, so this happens sooner. It happens more often in the theme editor, because the editor preview is narrower than your screen.
Related pages
- Custom work and code changes: what Krown support covers.
- JavaScript events: events for apps and custom scripts.
- Typography theme settings: the fonts you can pick without code.
- Product card theme settings: the badges Split shows.
- Edit the theme code: how to open the code editor.
Custom work and code changes
Custom work and code changes in Split: what Krown support covers, what needs a developer, and what happens to code edits when you update.
JavaScript events
JavaScript events in Split for developers: the krown:cart and krown:variant events the theme dispatches and how apps refresh the cart.