Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hirejordansmith/68f35c555e8decd4b72cb07b50b0390f to your computer and use it in GitHub Desktop.
Save hirejordansmith/68f35c555e8decd4b72cb07b50b0390f to your computer and use it in GitHub Desktop.
How to Get Cart Contents and Total Cost with WooCommerce
<a class="cart-contents" 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(); ?>
<i class="material-icons">shopping_cart</i>
</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment