Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active October 26, 2021 20:29
Show Gist options
  • Save woogists/9a16fd2d0c982e780a5de89c30cbbd25 to your computer and use it in GitHub Desktop.
Save woogists/9a16fd2d0c982e780a5de89c30cbbd25 to your computer and use it in GitHub Desktop.
[Theming Snippets] Show cart contents / total
// Use in conjunction with https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping 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>
@monaliska
Copy link

Hi there!
I tried to use this code but it gives me the error: syntax error, unexpected '<', expecting end of file
Please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment