Site logo

Archived topic

Shopping cart icon with load essential font-awesome fonts only

7 replies · Started by Coen on January 14, 2018

Viewing posts 1–8 of 8

Hi,

For speed reasons I dont want to load the complete font-awesome, but would like to replace CART in the menu by the shopping-cart icon. Therefore I created my own font with 2 icons.

This works fine on a test page:

<i class="coen icon-user" aria-hidden="true"></i>
<i class="coen icon-shopping-cart" aria-hidden="true"></i>

https://plasticplaten.com/test/

The icon-user also works fine in the menu, however I cant get the shopping-cart logo to show up, using the following code snippet:

add_filter( 'generate_woocommerce_menu_cart_icon', 'tu_change_wc_menu_cart_icon' );
function tu_change_wc_menu_cart_icon() {
return '<i class="coen icon-shopping-cart" aria-hidden="true"></i>';
}

What do I do wrong, or is there a workaround?

This looks like an issue with the way we've coded the feature. Let me look at it tomorrow to make it easier in 1.6. Then I can give you instructions to make the change on your install right away.

Thank you!

Got something working. Are you comfortable editing some core files if I give you instructions?

Hi Tom,

That is no problem.
Regards,
Coen

In wp-content/plugins/gp-premium/woocommerce/functions/functions.php, search for:

$icon = ( ! apply_filters( 'generate_fontawesome_essentials', false ) ) ? apply_filters( 'generate_woocommerce_menu_cart_icon', '<i class="fa fa-shopping-cart" aria-hidden="true"></i>' ) : __( 'Cart', 'gp-premium' );

Replace that line with:

$icon = apply_filters( 'generate_woocommerce_menu_cart_icon', '<i class="fa fa-shopping-cart" aria-hidden="true"></i>' );

Then your code should work.

Let me know :)

Hi Tom,

Works like a charm. Thanks a lot. Really impressed with your work and site speed performance!

Regards,
Coen

closed

Thanks for reporting the issue! :)

This archived topic is closed to new replies.