Custom fonts

Custom fonts

Start your free trial
Start your free trial

General

Online store speed
Online store speed
Accessibility
Accessibility
Theme updates
Theme updates

Theme styles

Style presets
Style presets
Colors
Colors
Fonts
Fonts
Animation
Animation
Social media
Social media

Header

Announcement bar
Announcement bar
Mobile menu
Mobile menu
Search bar
Search bar

Sections

Products

Product listings
Product listings
Product badges
Product badges
Quick view
Quick view
Quick add
Quick add

Product page

Product template
Product template
Variant chips
Variant chips
Sticky add-to-cart bar
Sticky add-to-cart bar
Sibling product swatches
Sibling product swatches
Product recommendations
Product recommendations

Collection page

Collections template
Collections template
Banner
Banner
Product grid
Product grid
Filters and sorting
Filters and sorting

Cart

Quick cart
Quick cart
Cart page
Cart page
Added-to-cart popup
Added-to-cart popup
Cross sells
Cross sells
Free shipping bar
Free shipping bar
Low inventory warning
Low inventory warning

Pages

Templates
Templates
Home page
Home page
About page
About page
Blogs page
Blogs page
Blog post
Blog post
Collections list
Collections list
Contact page
Contact page
Password page
Password page
Search page
Search page
404 page
404 page

Support

Support policy
Support policy
Shopify vs Theme issues
Shopify vs Theme issues
Store access requests
Store access requests

Advanced: Custom fonts

Note | We do not support code customizations. This guide offers a basic reference for advanced users familiar with HTML and CSS. Always test code changes on a duplicated, unpublished version of your theme. For assistance, we recommend finding a professional developer through Shopify Experts or Task Husky.

With Custom CSS, it's possible to add custom fonts with a few edits to your theme code. Custom fonts are uploaded to Shopify Files and then applied manually to different text elements in the Code editor.

Before deciding to use a custom font, we highly recommend considering one of the hundreds of fonts in Shopify's Font Picker as your first choice, since they are fully supported by all our themes.

Custom fonts will not appear as an option in the Theme Editor's font selector.

Watch video tutorial

Upload fonts to Shopify Files

All font files should be in WOFF and WOFF2 formats. While TTF and OTF can be used, they are not web-supported fonts and may cause issues. You can convert font formats with free tools like CloudConvert.

Using custom fonts may contribute to longer load-times. See our article about balancing features and customizations with your online store speed.

icon
STEPS

In your Shopify Admin:

  1. Go to Content > Files and click Upload files to add your WOFF and WOFF2 files.
  2. image
  3. Keep this window open for the next step.

Add fonts with Custom CSS in theme editor

After uploading your font files, you can import them in your Theme settings using the Custom CSS field.

icon
STEPS

In your Shopify Admin:

  1. Click Duplicate on your current theme.
  2. Click Customize on the duplicated, unpublished theme version.

In your theme editor (Customize):

  1. Go to Theme settings > Advanced.
  2. Click to open the Custom CSS tab.
  3. Copy and paste the following code on a new line:
  4. @font-face {
      font-family: "FONT NAME";
      src: url("FONT URL") format("woff"),
      url("FONT URL") format("woff2");
    }
  5. Replace FONT NAME with the exact name of your font. Example:
  6. @font-face {
      font-family: "Custom Font Name";
      src: url("FONT URL") format("woff"),
      url("FONT URL") format("woff2");
    }
  7. In your Shopify files, click the link icon to copy the URL and replace FONT URL for both the WOFF and WOFF2 formats. Example:
  8. image
    @font-face {
      font-family: "Custom Font Name";
      src: url("https://cdn.shopify.com/s/files/1/0518/6692/7292/files/DMSans-Regular.woff?v=1663348292") format("woff"),
      url("https://cdn.shopify.com/s/files/1/0518/6692/7292/files/DMSans-Regular.woff2?v=1663348302") format("woff2");
    }
    
  9. Click Save.
  10. Enter or paste the CSS code into the Custom styles box.
  11. Click Save.
  12. Click Preview to review your changes.
  13. Use the preview link to further test your changes on multiple browsers and devices.

  14. After testing, you can go to your Theme library to Publish the duplicated theme with your changes.

Apply fonts to theme text

Once you've added your font, you can apply it manually to elements of your theme with the CSS code below. Apply fonts globally to Logo, Headings, and Body text.

Logo, Headings, and Body text

Cornerstone groups theme text into 3 categories: LogoHeadings, and Body. Use the code below to override the font settings in your theme editor.

icon
STEPS

In your theme editor (Customize):

  1. Copy and paste the code below on a new line in the Custom CSS field of your theme settings.
  2. :root {
    /*
      --font-logo: unset;
      --font-logo-weight: unset;
      --font-logo-style: unset;
      */
    /*
      --font-heading: unset;
      --font-heading-weight: unset;
      --font-heading-style: unset;
      */
    /*
      --font-body: unset;
      --font-body-weight: unset;
      --font-body-style: unset;
      */
    }
    --font-logo applies to the site title (when no logo image is used).
    --font-heading applies to headings and subheadings for pages and sections.
    --font-body applies to paragraph, navigation, product listing, and button text.
  3. For each font you want to change, replace unset with the custom font name and delete the comment tags (/* and / on either side) . Example:
  4. :root {
    --font-logo: Custom Font Name;
    --font-logo-weight: unset;
    --font-style: unset;
    }
  5. (Optional.) If your font has multiple weights or styles, replace unset with the values for those properties. Example:
  6. :root {
      --font-logo: Custom Font Name;
      --font-logo-weight: 400;
      --font-style: italic;
    }
  7. Click Save.
  8. Click Preview Store to test and troubleshoot your code before publishing the theme.

Apply fonts to specific elements

Note | If your require assistance, we recommend contacting Shopify Experts or Task Husky.

Applying fonts to specific elements requires knowing how to use your browser's Inspector tool and familiarity with CSS selectors.

If that sounds like you, you can find and copy the CSS selector with the Inspector tool, then edit and use the following example below:

CSS-selector-name {
  font-family: "Custom Font Name" !important;
}

Add fonts with custom.css file

While we recommend using the available Custom CSS settings in the theme editor, you can use Cornerstone’s custom.css file to organize your custom code in a single place.

Enable useCustomCSS

To import the custom.css file, you need to enable useCustomCSS in the theme-globals.liquid file.

icon
STEPS

In the Theme code editor:

  1. Open the theme-globals.liquid file in the Snippets folder.
  2. Find the useCustomCSS variable and set it to true.
  3. {% assign useCustomCSS = false %}
  4. Open the custom.css file in the Assets folder.
  5. Add your custom code to import font files and apply them to your theme text.