{"id":5665,"date":"2022-10-27T07:51:14","date_gmt":"2022-10-27T07:51:14","guid":{"rendered":"https:\/\/littlethemeshop.com\/?p=5665"},"modified":"2023-08-12T00:13:09","modified_gmt":"2023-08-12T00:13:09","slug":"how-to-add-custom-fonts-to-a-shopify-theme","status":"publish","type":"post","link":"https:\/\/littlethemeshop.com\/how-to\/how-to-add-custom-fonts-to-a-shopify-theme\/","title":{"rendered":"How to Add Custom Fonts to a Shopify Theme"},"content":{"rendered":"\n

Out of the box, Shopify comes with a ton of font options that will meet most users needs. However, if you have your heart set on a specific font and need it added to your Shopify theme<\/a>, here’s a quick step-by-step tutorial to show you how to do that.<\/p>\n\n\n\n

Step 1: Download your font<\/h2>\n\n\n\n

Make sure you have a font file ready. Your font might be in TTF, OTF, WOFF, or WOFF2 format. Ideally, for the web, you should use a .woff or .woff2 format. You can convert your font using Font Squirrel’s webfont generator.<\/a><\/p>\n\n\n\n

Step 2: Upload your font<\/h2>\n\n\n\n
\"\"<\/figure>\n\n\n\n

Next, while in Shopify, go to Online Store > Themes > (three dots) > Edit Code. Scroll down to Assets <\/strong>and click “Add a new asset.” Upload your font file.<\/p>\n\n\n\n

Step 3: Add CSS<\/h2>\n\n\n\n

Next, open Header.liquid<\/strong> from under Sections<\/strong> and copy and paste the below code inside the <style><\/style> brackets. Remember to replace “your-font-file” with the file name of your custom font and “My Custom Font” with the name of your font.<\/p>\n\n\n\n

@font-face {\n  font-family: 'My Custom Font';\n  src: url('{{ 'custom-font.woff2' | asset_url}}') format('woff2'), url('{{ 'custom-font.woff' | asset_url}}') format('woff');\n  font-weight: normal;\n  font-style: normal;\n}\n\/* To replace the titles only *\/\n\nh1, h2, h3, h4, h5, h6 {\n  font-family: 'My Custom Font', sans-serif !important;\n}\n\/* To replace the body\/paragraphs only *\/\n\np, li, span {\n  font-family: 'My Custom Font', sans-serif !important;\n}<\/pre>\n\n\n\n

Save when you’re done and exit the Code Editor. You should see your changes, but if you don’t, remember to clear your browser cache.<\/p>\n\n\n\n

Update: Alternative Method<\/h2>\n\n\n\n

If the above method doesn’t work, try uploading your font file under Content > Files <\/strong>instead. Next, copy the link and use this CSS code instead, replacing “your-font-link” with the link you just copied:<\/p>\n\n\n\n

@font-face {\n  font-family: 'My Custom Font';\n  src: url('{{ 'your-font-link}}') format('woff2'), url('{{ 'your-font-link}}') format('woff');\n  font-weight: normal;\n  font-style: normal;\n}\n\/* To replace the titles only *\/\n\nh1, h2, h3, h4, h5, h6 {\n  font-family: 'My Custom Font', sans-serif !important;\n}\n\/* To replace the body\/paragraphs only *\/\n\np, li, span {\n  font-family: 'My Custom Font', sans-serif !important;\n}<\/pre>\n\n\n\n

<\/p>\n","protected":false},"excerpt":{"rendered":"

If you have your heart set on a specific font and need it added to your Shopify theme, here’s a quick step-by-step tutorial to show you how to do that.<\/p>\n","protected":false},"author":1,"featured_media":5666,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[310],"tags":[328,364],"class_list":["post-5665","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","tag-how-to","tag-shopify-tutorial"],"_links":{"self":[{"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/posts\/5665"}],"collection":[{"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/comments?post=5665"}],"version-history":[{"count":4,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/posts\/5665\/revisions"}],"predecessor-version":[{"id":6124,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/posts\/5665\/revisions\/6124"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/media\/5666"}],"wp:attachment":[{"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/media?parent=5665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/categories?post=5665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/littlethemeshop.com\/wp-json\/wp\/v2\/tags?post=5665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}