Skip to content

Instantly share code, notes, and snippets.

@qant
Created May 28, 2022 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qant/5d0248012d516339826ca9e2fe26025c to your computer and use it in GitHub Desktop.
Save qant/5d0248012d516339826ca9e2fe26025c to your computer and use it in GitHub Desktop.
Woocommerce minicart
<?php
echo '<a href="#" class="dropdown-back" data-toggle="dropdown"> ';
echo '<i class="fa fa-shopping-cart" aria-hidden="true"></i>';
echo '
<div class="basket-item-count" style="display: inline;">';
echo '<span class="cart-items-count count">';
echo WC()->cart->get_cart_contents_count();
echo '</span>';
echo '
</div>
';
echo '</a>';
echo '
<ul class="dropdown-menu dropdown-menu-mini-cart">';
echo '
<li>
<div class="widget_shopping_cart_content">';
woocommerce_mini_cart();
echo '
</div>
</li>
</ul>';
?>
<p>Or:</p>
<!-- WORKING MINI CART!!! -->
<div>
<a href="#" class="dropdown-back" data-toggle="dropdown">
<i class="fa fa-shopping-cart" aria-hidden="true"></i>
<div class="basket-item-count" style="display: inline;">
<span class="cart-items-count count">
<?php WC()->cart->get_cart_contents_count(); ?>
</span>
</div>
</a>
<ul class="dropdown-menu dropdown-menu-mini-cart">
<li>
<div class="widget_shopping_cart_content">
<?php woocommerce_mini_cart(); ?>
</div>
</li>
</ul>
</div>
@qant
Copy link
Author

qant commented May 28, 2022

Fully functional but not styled mini cart where you can interact with it

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