Add custom fonts to your theme

Maison generates its typography styles in:

components/theme-css-var.html

This file creates the font faces selected in Theme settings > Typography and defines the CSS variables used throughout the theme.

You can use this file to load your own font files and replace Maison's default Title and/or Body font families.

How to Add Custom Fonts in Maison

Steps:

Prepare your custom font files

Prepare the font files you want to use.

SHOPLINE's File library supports common font formats including:

.woff
.woff2
.ttf
.otf

For storefront performance, use WOFF2 when it is available.

If the font family includes multiple weights, prepare a separate file for each weight you want to use.

For example:

BrandFont-Regular.woff2    → 400
BrandFont-Medium.woff2     → 500
BrandFont-Semibold.woff2   → 600
BrandFont-Bold.woff2       → 700

Only upload the font weights that your storefront needs.

Upload the custom font files to SHOPLINE
  • From your SHOPLINE admin, open Settings > File library.

  • Click Upload files.

docs__maison__add-custom-fonts-to-your-theme__02.webp
  • Upload your custom font files.

  • After each file has been uploaded, copy its file URL.

docs__maison__add-custom-fonts-to-your-theme__03.webp

Keep the URLs available because they will be added to components/theme-css-var.html.

Open the Maison theme code
  • From your SHOPLINE admin, open Online Store > Themes.

  • Locate the Maison theme you want to customize.

  • Click the ... menu on the theme.

  • Select Edit code.

docs__maison__add-custom-fonts-to-your-theme__01.webp
  • In the code editor, open:

    components/theme-css-var.html
    

Before editing the file, save a copy of the original code so you can restore it if necessary.

Understand the existing font code

At the beginning of components/theme-css-var.html, Maison reads the fonts selected in the Theme Editor:

{{~#var title_font = settings.sort_title_font /}}
{{~#var body_font = settings.sort_body_font /}}

Maison then generates font faces for common font weights:

{{{~ title_font | font_modify("weight", "400") | font_face() ~}}}
{{{~ title_font | font_modify("weight", "500") | font_face() ~}}}
{{{~ title_font | font_modify("weight", "600") | font_face() ~}}}
{{{~ title_font | font_modify("weight", "700") | font_face() ~}}}

The same logic is used for the Body font.

Later in the file, Maison assigns these font families to the main typography variables:

--sort-title-font: "{{ title_font.family }}", "{{ title_font.fallback_families }}";
--sort-body-font: "{{ body_font.family }}", "{{ body_font.fallback_families }}";

To use a custom font, you can add your own @font-face rules and replace these font-family variables.

Add a custom font-face declaration

Inside the existing <style> element, add your custom @font-face code before the :root block.

For example:

@font-face {
  font-family: "Brand Font";
  src: url("YOUR-FONT-FILE-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

Replace:

Brand Font

with the name you want to use for your font family.

Replace:

YOUR-FONT-FILE-URL

with the URL copied from the SHOPLINE File library.

The result should be placed before:

:root {

For example:

{{{~ body_font | font_face() ~}}}

@font-face {
  font-family: "Brand Font";
  src: url("YOUR-FONT-FILE-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
Add multiple font weights

If your custom font contains several font weights, create one @font-face rule for each file.

For example:

@font-face {
  font-family: "Brand Font";
  src: url("REGULAR-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("MEDIUM-FONT-URL") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("SEMIBOLD-FONT-URL") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("BOLD-FONT-URL") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

Use the same font-family name for every weight belonging to the same font family.

Make sure each rule uses the correct font-weight value.

Apply the custom font to Title typography

Find this line inside the :root block:

--sort-title-font: "{{ title_font.family }}", "{{ title_font.fallback_families }}";

Replace it with:

--sort-title-font: "Brand Font", sans-serif;

For example:

--sort-title-font: "Maison Custom", sans-serif;

Maison will now use the custom font anywhere the theme uses the Title font family.

The existing Title typography settings can continue to control properties such as:

  • Font weight
  • Letter spacing
  • Font size
  • Line height
  • Uppercase
Apply the custom font to Body typography

Find this line:

--sort-body-font: "{{ body_font.family }}", "{{ body_font.fallback_families }}";

Replace it with:

--sort-body-font: "Brand Font", sans-serif;

Maison will now use the custom font anywhere the theme uses the Body font family.

The existing Body typography settings continue to control the remaining typography properties.

Use the same custom font for Title and Body

If you want to use the same custom font throughout the storefront, change both variables:

--sort-title-font: "Brand Font", sans-serif;
--sort-body-font: "Brand Font", sans-serif;

You do not need to change the Navigation, Button, or Product grid font variables.

Maison already makes those typography groups inherit either the Title or Body font.

Use different custom fonts for Title and Body

You can load two separate custom font families.

For example:

@font-face {
  font-family: "Brand Heading";
  src: url("HEADING-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Body";
  src: url("BODY-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

Then change the Maison variables to:

--sort-title-font: "Brand Heading", sans-serif;
--sort-body-font: "Brand Body", sans-serif;

This gives you one custom font for headings and another for body text.

Keep Navigation connected to Title or Body

Maison defines the Navigation font with:

--sort-navigation-font: var(--sort-{{ settings.sort_navigation_font }}-font);

You do not need to replace this variable.

From Theme settings > Typography > Navigation, use Font from to choose:

Title

or:

Body

If Navigation is set to Title, it automatically uses your custom Title font.

If Navigation is set to Body, it automatically uses your custom Body font.

Keep Buttons connected to Title or Body

Maison defines the Button font with:

--sort-button-font: var(--sort-{{ settings.sort_button_font }}-font);

Leave this line unchanged.

From Theme settings > Typography > Buttons, select whether the button typography should inherit:

Title

or:

Body

The custom font is inherited automatically.

Keep Product grid typography connected to Title or Body

Maison defines product-card typography with:

--sort-product-font: var(--sort-{{ settings.sort_product_font }}-font);

Leave this line unchanged.

From Theme settings > Typography > Product grid, select:

Title

or:

Body

Product cards will automatically use the corresponding custom font.

Match the custom font weights to Maison settings

Maison can use common font weights such as:

400
500
600
700

If your design uses these weights, upload and define the matching font files.

For example:

@font-face {
  font-family: "Brand Font";
  src: url("REGULAR-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("BOLD-FONT-URL") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

If Maison requests a font weight that has not been defined, the browser may simulate the weight from another available font file.

For the most consistent result, define the actual font weights used by your storefront.

Use a custom font with only one available weight

If your custom font only provides one weight, such as Regular 400, you can also hard-code the related Maison font weight.

For the Title font, change:

--sort-title-font-weight: {{ title_font.weight }};

to:

--sort-title-font-weight: 400;

For the Body font, change:

--sort-body-weight: {{ body_font.weight }};

to:

--sort-body-weight: 400;

Only do this when you intentionally want the custom font to use a fixed weight.

If you have multiple font-weight files, keep Maison's existing weight settings so you can continue adjusting typography from the Theme Editor.

Add a custom italic font

If your custom font includes an italic file, add a separate font-face rule.

For example:

@font-face {
  font-family: "Brand Font";
  src: url("REGULAR-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("ITALIC-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

This allows the browser to use the actual italic font file instead of generating a simulated italic style.

Save and preview the custom font
  • Save components/theme-css-var.html.

  • Open the storefront preview.

  • Check:

    • Headings
    • Body text
    • Navigation
    • Buttons
    • Product cards
    • Product pages
    • Collection pages
    • Cart
    • Drawers
    • Popups
    • Footer
  • Test both desktop and mobile layouts.

  • If your store uses multiple languages, test characters from each language.

If the result is correct, keep a copy of the customized file for future theme updates.

Recommended code example

The following example adds a custom font with Regular, Medium, Semibold, and Bold weights and uses it for both Title and Body typography.

Add the font-face rules before the :root block:

@font-face {
  font-family: "Brand Font";
  src: url("REGULAR-FONT-URL") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("MEDIUM-FONT-URL") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("SEMIBOLD-FONT-URL") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Brand Font";
  src: url("BOLD-FONT-URL") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

Then find:

--sort-title-font: "{{ title_font.family }}", "{{ title_font.fallback_families }}";

and replace it with:

--sort-title-font: "Brand Font", sans-serif;

Find:

--sort-body-font: "{{ body_font.family }}", "{{ body_font.fallback_families }}";

and replace it with:

--sort-body-font: "Brand Font", sans-serif;

How Maison uses the font variables

Maison uses two main font-family variables:

--sort-title-font
--sort-body-font

Navigation, Buttons, and Product grid then inherit one of those font families:

--sort-navigation-font: var(--sort-{{ settings.sort_navigation_font }}-font);
--sort-button-font: var(--sort-{{ settings.sort_button_font }}-font);
--sort-product-font: var(--sort-{{ settings.sort_product_font }}-font);

Because of this structure, changing Title and Body at the CSS-variable level automatically makes the custom font available to the other typography groups.

Theme Editor behavior after the customization

After you replace --sort-title-font or --sort-body-font with a custom font family, the font selector in Theme settings > Typography may still display the SHOPLINE font that was selected previously.

This is expected.

The Theme Editor setting still provides values for the original title_font and body_font objects, but your modified CSS variable overrides the font family used on the storefront.

Other typography controls can continue to work, including:

  • Letter spacing
  • Font size
  • Line height
  • Font weight
  • Uppercase
  • Navigation Font from
  • Buttons Font from
  • Product grid Font from

Existing Maison font-face code

The original file automatically creates font-face declarations for the Title and Body fonts selected from the Theme Editor.

It includes common weights:

400
500
600
700

Your custom @font-face declarations are added in addition to these generated font faces.

You do not need to remove the original font-face code for the customization to work.

Keeping the original code makes it easier to restore the standard Maison typography later.

Font preloading

At the bottom of components/theme-css-var.html, Maison can preload the fonts selected through the normal Theme Editor settings when Preload theme fonts is enabled.

The original preload logic uses:

{{ body_font | font_url() }}
{{ title_font | font_url() }}

Because an uploaded custom font is not part of those original font objects, Maison's standard preload logic does not automatically preload the custom font URL.

This does not prevent the custom font from working. The browser will load it through your @font-face declaration.

If you manually add custom font preloading, make sure it references the correct custom font URL and only preload fonts that are needed immediately.

Font fallback

Always provide a fallback family.

For a sans-serif font:

--sort-title-font: "Brand Font", sans-serif;

For a serif font:

--sort-title-font: "Brand Serif", serif;

The fallback is used if the custom font cannot load or does not contain a required character.

Important notes

  • The customization is made in components/theme-css-var.html.
  • Font files can be uploaded to Settings > File library.
  • Use only font files that you have permission to use.
  • WOFF2 is recommended when available.
  • Each font weight should have its own @font-face declaration.
  • The Title font is controlled by --sort-title-font.
  • The Body font is controlled by --sort-body-font.
  • Navigation, Buttons, and Product grid can continue inheriting Title or Body.
  • Do not remove unrelated color, spacing, border, or layout variables from the file.
  • Keep a backup of the original file before making changes.
  • Keep a copy of your custom font code because a future manual theme update may require the customization to be reapplied.
  • Editing theme source code turns the theme into a custom theme and can affect automatic theme updates.

Troubleshooting

If the custom font does not appear, check that the font-family name in the CSS variable exactly matches the name in your @font-face declarations.

If the font file does not load, verify that the URL copied from the SHOPLINE File library is correct and accessible.

If the Title font changes but Body text does not, make sure you also replaced:

--sort-body-font

If Body text changes but headings do not, make sure you also replaced:

--sort-title-font

If Navigation uses the wrong font, check Theme settings > Typography > Navigation > Font from.

If Buttons use the wrong font, check Theme settings > Typography > Buttons > Font from.

If Product grid text uses the wrong font, check Theme settings > Typography > Product grid > Font from.

If bold text does not look correct, make sure the corresponding font-weight file has been uploaded and declared with the correct font-weight.

If italic text does not look correct, upload and define a true italic font file.

If some translated characters use the fallback font, the custom font may not contain those characters. Use a font file that supports the required language.

If the font becomes too heavy or too light after changing Theme Editor settings, make sure the selected weight matches one of the weights included in your custom font-face declarations.

If the storefront breaks after editing the file, restore your backup of components/theme-css-var.html and apply the changes again carefully.


Need Further Assistance

If you encounter any issues or need additional help with your Maison theme, please reach out to our support team via our Ticket System for assistance within 8 hours.