jaw@jawtemplates.com

How to make the shopping cart option in the top bar unclickable when empty

Please chenge whole content of /goodstore/templates/header/top_bar/woo_cart.php by this code:

<?php
global $woocommerce;
if (sizeof(WC()->cart->get_cart()) > 0) {
$cart_link = '#';
} else {
$cart_link = $woocommerce->cart->get_cart_url();
}
?>
<a aria-haspopup="true" href="<?php echo $cart_link; ?>" title="<?php _e('View your shopping cart', 'jawtemplates'); ?>">

<span></span>
<span>
<?php _e('Shopping cart', 'jawtemplates'); ?>
</span>
<span>
(<?php echo $woocommerce->cart->cart_contents_count; ?>):
</span>
<span>
<?php echo $woocommerce->cart->get_cart_total(); ?>
</span>
</a>
<div>
<?php echo '<div ></div>'; ?>
</div>
  • Was this Helpful ?
  • yes   no

Leave a Reply

You must be logged in to post a comment.