Tagged: Cart, counter, icon, woocommerce
Hello,
In the main menu I’ve insert a fontawesome bag icon istead of the woocommerce cart icon that refer to the cart page, I made several test with the Yigit code that I’ve found on this forum, but I wasn’t able to set an icon on the shortcode [count_cart].
Any suggestions?
Thank you!
Here’s the code I’ve found:
function avia_cart_count(){
global $woocommerce;
$count = $woocommerce->cart->cart_contents_count;
if ($count > 0) {
$avia_count = sprintf(_n(‘ %d’, $woocommerce->cart->cart_contents_count, ‘woothemes’), $woocommerce->cart->cart_contents_count);
return “<span class=’counter’>/ “.$avia_count.”</span>”;
}
}
add_shortcode( ‘cart_count’, ‘avia_cart_count’ );
Hey opificioilgranello,
Sorry for the late reply, I believe I found the reference to the code you are using and it was designed to show without the count.
In your case you want to show the count, so a solution would be to use the woocommerce cart instead of your shortcode and then replace the icon to your bag in the functions.php file at around line 248:
'cart' => array( 'font' =>'entypo-fontello', 'icon' => 'ue859'),
just replace ue859 with your icon code.
Best regards,
Mike