A store owner is experiencing inconsistent font rendering across browsers after a developer added custom fonts using TTF files. They’ve now uploaded WOFF and WOFF2 versions and need help implementing them correctly.
Solution provided:
Upload .woff and .woff2 files to the Assets folder in Shopify theme code
Add @font-face declaration in theme.css or base.css using Shopify’s Liquid syntax:
Hello, we had a developer add a custom font to our site.
The files which were uploaded were ttf files, and we are seeing inconsistent fonts across various browsers.
We’ve now uploaded woff and woff2 versions of the font to our content files, and we’d like someone to help with adding the woff files, and pointing in the code to hopefully fix the consistency issue.
Inconsistency is happening because not all browsers support TTF files the same way. Using WOFF and WOFF2 is the right approach, as they are widely supported and optimized for the web. Here’s how you can fix it:
Upload the font files
Make sure your .woff and .woff2 files are uploaded to your Shopify Assets folder (e.g., Assets/custom-font.woff2).
Update your CSS to use the new files
Add a @font-face declaration in your theme’s CSS (e.g., base.css or theme.css):
@font-face {
font-family: 'CustomFont';
src: url('{{ "custom-font.woff2" | asset_url }}') format('woff2'),
url('{{ "custom-font.woff" | asset_url }}') format('woff');
font-weight: normal;
font-style: normal;
font-display: swap;
}
body {
font-family: 'CustomFont', sans-serif; /* Apply your font where needed */
}