Add Google Fonts to Theme in Magento 2

0
17717
Add Google Fonts to Theme in Magento 2
Add Google Fonts to Theme in Magento 2

If you like to change fonts of theme, then Google Fonts is the best to use. I will show you how to add Google Fonts to theme in Magento 2.

First, you need to visit Google Fonts and select a font to use for your theme.

Then, in your theme, update this file app\design\frontend\VENDOR\THEME\Magento_Theme\layout\default_head_blocks.xml :

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <link src_type="url" type="text/css" src="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,600;1,700&amp;display=swap" rel="stylesheet" />
    </head>
</page>

Afterward, refresh the page to see the new Google Font applied on your theme.

Have fun ~