1

I would like to change the + in the css into a shopping cart. I have installed Font Awesome on my site but when i put the line <i class="fa fa-cart-plus"></i> in it does not work.

It looks like this in the css so i want the + in content to be the shopping cart instead. Can anyone help me?

.woocommerce #content-container a.button.add_to_cart_button:before, .woocommerce-page #content-container a.button.add_to_cart_button:before, .woocommerce #content-container button.button.add_to_cart_button:before, .woocommerce-page #content-container button.button.add_to_cart_button:before, .woocommerce #content-containerinput.button.add_to_cart_button:before, .woocommerce-page #content-containerinput.button.add_to_cart_button:before, .woocommerce #content-container#respond input#submit.add_to_cart_button:before, .woocommerce-page #content-container#respond input#submit.add_to_cart_button:before, .woocommerce #content-container#content input.button.add_to_cart_button:before, .woocommerce-page #content-container#content input.button.add_to_cart_button:before, .woocommerce #content-container a.button.add_to_cart_button:before, .woocommerce-page #content-container a.button.add_to_cart_button:before, .woocommerce .products a.button.add_to_cart_button:before, .woocommerce-page .products a.button.add_to_cart_button:before, .woocommerce .products button.button.add_to_cart_button:before, .woocommerce-page .products button.button.add_to_cart_button:before, .woocommerce .products input.button.add_to_cart_button:before, .woocommerce-page .products input.button.add_to_cart_button:before, .woocommerce #respond.products input#submit.add_to_cart_button:before, .woocommerce-page #respond.products input#submit.add_to_cart_button:before, .woocommerce #content.products input.button.add_to_cart_button:before, .woocommerce-page #content.products input.button.add_to_cart_button:before, .woocommerce .products a.button.add_to_cart_button:before, .woocommerce-page .products a.button.add_to_cart_button:before {
color: #ffffff;
content: "+";
font-size: 20px;
left: 0px;
line-height: 10px;
margin-right: 15px;
position: relative;
top: 3px;

}

2 Answers2

1

You'll need to add the icon using its the ASCII code. You can figure out the ASCII in the Font Awesome Cheat Sheet. There you have all the icons and their Unicode representation. The one you want is the fa-cart-plus one that is &#xf217;. The ASCII version of this is the four hexadecimal numbers before the semi-colon with a leading backslash: \f217.

Once we have that, we can use it in the CSS as follows:

HTML

<p><span class="cart"></span></p>

CSS

.cart:before {
    font-family: FontAwesome;
    content: "\f217";
}

Working JSFiddle.

(Obviously you'll need to have the Font Awesome library installed and included.)

Your CSS should look like this

.woocommerce #content-container a.button.add_to_cart_button:before, .woocommerce-page #content-container a.button.add_to_cart_button:before, .woocommerce #content-container button.button.add_to_cart_button:before, .woocommerce-page #content-container button.button.add_to_cart_button:before, .woocommerce #content-containerinput.button.add_to_cart_button:before, .woocommerce-page #content-containerinput.button.add_to_cart_button:before, .woocommerce #content-container#respond input#submit.add_to_cart_button:before, .woocommerce-page #content-container#respond input#submit.add_to_cart_button:before, .woocommerce #content-container#content input.button.add_to_cart_button:before, .woocommerce-page #content-container#content input.button.add_to_cart_button:before, .woocommerce #content-container a.button.add_to_cart_button:before, .woocommerce-page #content-container a.button.add_to_cart_button:before, .woocommerce .products a.button.add_to_cart_button:before, .woocommerce-page .products a.button.add_to_cart_button:before, .woocommerce .products button.button.add_to_cart_button:before, .woocommerce-page .products button.button.add_to_cart_button:before, .woocommerce .products input.button.add_to_cart_button:before, .woocommerce-page .products input.button.add_to_cart_button:before, .woocommerce #respond.products input#submit.add_to_cart_button:before, .woocommerce-page #respond.products input#submit.add_to_cart_button:before, .woocommerce #content.products input.button.add_to_cart_button:before, .woocommerce-page #content.products input.button.add_to_cart_button:before, .woocommerce .products a.button.add_to_cart_button:before, .woocommerce-page .products a.button.add_to_cart_button:before {
    color: #ffffff;
    font-family: FontAwesome; /* Here */
    content: "\f217"; /* And here */
    font-size: 20px;
    left: 0px;
    line-height: 10px;
    margin-right: 15px;
    position: relative;
    top: 3px;
}
Niklas
  • 1,684
  • 11
  • 19
0

Did you try <i class="icon-shopping-cart"></i> ? See list of icons

Tepken Vannkorn
  • 9,550
  • 14
  • 58
  • 85