- This topic has 19 replies, 3 voices, and was last updated 3 years, 11 months ago by
Leo.
-
AuthorPosts
-
June 12, 2019 at 4:08 am #926754
Sam
Hi I am trying to implement changing the cart icon from this: https://docs.generatepress.com/article/generate_woocommerce_menu_cart_icon/
However, the snippet generates the new icon but does not remove the original one and so it now shows both. The code I have used is
add_filter( ‘generate_woocommerce_menu_cart_icon’, ‘tu_change_wc_menu_cart_icon’ );
function tu_change_wc_menu_cart_icon() {
return ‘<i class=”fas fa-shopping-bag” aria-hidden=”true”></i>’;
}I added it using the Snippets plugin.
June 12, 2019 at 4:14 am #926757David
StaffCustomer SupportHi there,
can you link me to the site so i can take a look?
You can edit your original topic and use the Site URL field to share the link privately.June 12, 2019 at 4:17 am #926760Sam
Hi, really sorry I am still working on a mamp server while. I have requested my staging site be set up, just waiting for it…
Please see screen shot: https://www.dropbox.com/s/kwjiau2l3gwiada/Screenshot%202019-06-12%20at%2013.17.16.png?dl=0
thanks
SamJune 12, 2019 at 4:24 am #926767David
StaffCustomer SupportIt looks as thought that filter no longer applies with the new shopping cart set-up ill pass that on to Tom.
You can use CSS like this:
.main-navigation a.cart-contents.shopping-bag:before { content: '\f290'; font-family: 'Font Awesome\ 5 Free'; }
May need to double check the
.shopping-bag
class depending on what icon you have selected in GP and the CSS unicode for the FA icon and the font familyJune 12, 2019 at 5:17 am #926805Sam
Got it, thanks that worked although I had to do the code like this:
.main-navigation a.cart-contents.shopping-bag:before {
content: ‘\f290’;
font-family: ‘FontAwesome’;
}thanks.
June 12, 2019 at 5:22 am #926810David
StaffCustomer SupportAwesome – glad you got it resolved.
June 14, 2019 at 7:24 am #929662Sam
Hi David, you’ll be pleased to know I have sorted out the staging site : )
I have just noticed this does not work when on the website home page, do you have any idea why this might be? I am using a custom header for this page, could that have an effect?
June 14, 2019 at 7:26 am #929666Sam
If I disable this Element then it displays the new cart icon just fine. Is there some separate CSS for this?
thanks
June 14, 2019 at 2:23 pm #929997David
StaffCustomer SupportHave you tried flushing caches as the correct code is there?
If not try just targeting:
.main-navigation a.cart-contents:before
and giving each of the properties!important
June 17, 2019 at 1:19 am #931926Sam
Hi, below is the code I am using, even with the adding !important it does not fix the cart icon on the home page:
/**** Change Cart Icon ****/ .main-navigation a.cart-contents.shopping-bag:before { content: '\f290'!important; font-family: 'FontAwesome'!important; }
any from your comments;
/**** Change Cart Icon ****/ .main-navigation a.cart-contents:before { content: '\f290'!important; font-family: 'FontAwesome'!important; }
Neither work.
Any ideas what I am doing wrong?
June 17, 2019 at 2:36 am #932002David
StaffCustomer SupportCan you try the fontawesome family name i provided here
Best to flush and disable autoptimize when making customizations.
June 17, 2019 at 2:54 am #932023Sam
Hi David, that code results in a broken icon (with the square). That is why I used the term I did.
I have flushed Autoptimize and no change.
June 17, 2019 at 8:17 am #932418Leo
StaffCustomer SupportLooks like it’s working? I can see all the icons:
https://www.screencast.com/t/FiV1q0ilJune 17, 2019 at 8:24 am #932433Sam
Hi Leo, please navigate to any other page and check the cart icon, this is the one set with custom CSS. However, my problem as this for some reason will not work on the home page. The only difference is I have a Header Element on the home page for the transparent nav. Does that make sense?
June 17, 2019 at 8:37 am #932448Leo
StaffCustomer SupportHmm how are you loading FA?
-
AuthorPosts
- You must be logged in to reply to this topic.