Last active
August 29, 2015 14:10
-
-
Save lmartins/6e8dcf20138ee91b6377 to your computer and use it in GitHub Desktop.
Display WooCommerce Cart contents (only items quantity and total amount)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CART CONTENTS | |
* Mostra informação sobre conteúdo actual do carrinho | |
*/ | |
add_action( 'genesis_site_title', 'mw_show_cart_contents' ); | |
function mw_show_cart_contents() | |
{ | |
global $woocommerce; | |
if ( sizeof( $woocommerce->cart->cart_contents ) !== 0 ) { | |
$out = '<a class="widget-cart-contents" href="' . $woocommerce->cart->get_cart_url() . '">'; | |
$out .= '<span class="quantity">' . sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count) . "</span>"; | |
$out .= $woocommerce->cart->get_cart_total(); | |
// $out .= $woocommerce->cart->get_cart_subtotal(); // With VAT included | |
$out .= "</a>"; | |
echo $out; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment