Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php /* Use this code anywhere in your theme's PHP file(s) to display a shopping cart link with number of items in the cart*/ ?>
  2. <?php if (class_exists('wpCheckout')) { $wpCheckout = new wpCheckout(); }; ?>
  3. <?php global $wpcoHtml, $Item, $Order; ?>
  4. <?php $number_items = $Item -> item_count($Order -> current_order_id(), "items"); //you can change "items" to "units" to display number of units ?>
  5.  
  6. <?php if (!empty($number_items)) : ?>
  7.     <a href="<?php echo $wpcoHtml -> cart_url(); ?>" title="Shopping Cart">Shopping Cart (<?php echo $number_items; ?>)</a>
  8. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement