If you wanted to display Cart items and total cost for individual user, use this code below
<?php
global $woocommerce;
// cart quantity
$qty = $woocommerce->cart->get_cart_contents_count();
// cart total
$total = $woocommerce->cart->get_cart_total();
// cart url
$cart_url = $woocommerce->cart->get_cart_url();
?>
<?php
// To Display Cart Quantity
if($qty>=1) { ?>
<div class="quantinty"><?php echo $qty; ?></div>
<?php } ?>
<?php
//To Display Total Cost
if($qty>=1)
echo '<span> '.$total.'</span>'; else { ?>
<span>Cart is Empty</span>
<?php } ?>
<?php
global $woocommerce;
// cart quantity
$qty = $woocommerce->cart->get_cart_contents_count();
// cart total
$total = $woocommerce->cart->get_cart_total();
// cart url
$cart_url = $woocommerce->cart->get_cart_url();
?>
<?php
// To Display Cart Quantity
if($qty>=1) { ?>
<div class="quantinty"><?php echo $qty; ?></div>
<?php } ?>
<?php
//To Display Total Cost
if($qty>=1)
echo '<span> '.$total.'</span>'; else { ?>
<span>Cart is Empty</span>
<?php } ?>
No comments:
Post a Comment