[Resolved] Shopping cart icon with load essential font-awesome fonts only

Home Forums Support [Resolved] Shopping cart icon with load essential font-awesome fonts only

Home Forums Support Shopping cart icon with load essential font-awesome fonts only

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #470908
    Coen

    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?

    #471090
    Tom
    Lead Developer
    Lead Developer

    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!

    #471554
    Tom
    Lead Developer
    Lead Developer

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

    #471642
    Coen

    Hi Tom,

    That is no problem.
    Regards,
    Coen

    #471891
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #471991
    Coen

    Hi Tom,

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

    Regards,
    Coen

    #471994
    Coen

    closed

    #472384
    Tom
    Lead Developer
    Lead Developer

    Thanks for reporting the issue! ๐Ÿ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.