Skip to content

Instantly share code, notes, and snippets.

@mmh4560
Created January 13, 2019 10:58
Show Gist options
  • Save mmh4560/715a8d8f313c8e0559eb224aa25ce86d to your computer and use it in GitHub Desktop.
Save mmh4560/715a8d8f313c8e0559eb224aa25ce86d to your computer and use it in GitHub Desktop.
How to add Woocommerce Cart Icon in home page
<!-- Use this code where do you want to show your cart icon -->
<div class='my-cart'>
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e('View Cart'); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
</div>
/* Here is css */
.cart-contents::before {
font-family: WooCommerce;
content: "\e01d";
font-size: 20px;
font-style: normal;
vertical-align: bottom;
padding-right: 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment