How to Add & Use Google Fonts in Magento 2

Magento 2 store owners may want to get creative with fonts once in a while!

Instead of paying for the fonts library, one can add & use Google fonts in Magento 2 store.

For example, your business targets kids, or women, or professionals, you may want to choose the font of your website accordingly for each case.

Google fonts are readily available and easy to use. Also, they are free of cost and the store owner can choose among thousands of fonts available that will be suitable for their customer base or type of business.

Also, if you are a Magento developer and need fonts other than the default ones to use in your Magento extensions or themes, you may use the below solution.

Method to Add & Use Google Fonts in Magento 2:

Put the following code at Vendor\Extension\View\frontend\layout\default_head_blocks.xml file or Vendor\Your_Theme\Magento_Theme\layout\default_head_blocks.xml

You can import multiple google fonts by using:

or you can use directly .phtml file as shown below:

Import multiple google fonts in phtml file

Once done, you can use the Google fonts like this:

That’s it. Let your creative juices flow freely while developing your Magento site, extensions, or themes when it comes to fonts!

Any doubts? Do mention them in the Comments section below.

I’d be happy to help.

Please share the post with the Magento Community via social media.

Thank you.

(based on 1 Reviews)
How to Add & Use Google Fonts in Magento 2

Ronak Bhatti

Ronak is a Magento Developer at Meetanshi. He loves playing cricket. Apart from the work, he is an enthusiastic person who loves learning new skills.

Leave a Reply

Your email address will not be published. Required fields are marked *