<?php
defined('ABSPATH') || exit('No Access!');

$cart_count = WC()->cart->cart_contents_count;
?>
<div class="mini-cart">
    <a href="<?php echo wc_get_cart_url(); ?>" id="cart-button">
        <?php echo $cart_count ? '<span class="cart-counter">' . $cart_count . '</span>' : null; ?>
    </a>
    <div class="mini-cart-content"><?php woocommerce_mini_cart(); ?></div>
</div>