The last update (Sept. 2016) of the Woocommerce Storefront theme has included Google fonts into the theme. While WordPress has finally removed its Open Sans font from the core, WooThemes decided to add a default font from Google. And then to sell their Storefront extensions to remove it. Nice.
But we still could easily remove their fonts from child theme functions.php
with the following snippet.
// Remove Google Font from Storefront theme
function iggy_child_styles(){
wp_dequeue_style('storefront-fonts');
}
add_action( 'wp_enqueue_scripts', 'iggy_child_styles', 999);
It removes also new rel='dns-prefetch'
from the page’s head.
If you just need to change Google font from the default one, you may use the snippet taken from here.
add_filter( 'storefront_google_font_families', 'my_font_families' );
function my_font_families( $family ) {
$family['merienda'] = 'Merienda:400,700';
return $family;
}
I love the Storefront theme, but the last updates tend to change too many things in its layout and classes. Hard to update sites. Each time we need to check and tweak many things again and again.
Thank you, that works well for me. It’s useful for users behind the Great Firewall of China.
iād just (ok, 2 years ago š tested your function code for // Remove Google Font from Storefront theme and it works as expected, fine.
but, i think there is one thing left:
cause i want to use the mentioned fonts really further on, but served from my own host – do you know an same easy working function to replace the fonts?
CAOS for Webfonts plugin can locally store Google Fonts.
It is still working in 2023. Thx.
No additional plugin is needed. Just generate code with Google Webfonts Helper. Paste the css code and upload the files via FTP. Done.