Print Reseller Scheme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to hide shopping cart if empty?

Discussion in 'Website Coding & Programming Forum:' started by bigdave, Sep 10, 2014.

  1. bigdave

    bigdave Moderator Staff Member

    I'm working on a site which is primarily based on wordpress but uses magento to deal with its e-commerce.

    When a product is selected, it links through to the magento shopping cart. We have a site wide "View Cart" link in the head of the site which links to the magento cart. What I'd like to do is to hide this link if the cart is empty.

    Working soley in magento I could use this to hide the link:
    <?php $_cartQty $this->getSummaryCount() ?>
    if ($_cartQty >0): ?>
    <a href="link">link to cart</a>
    <?php endif ?>
    but it doesn't work for wordpress... Is there a way to get the cart count from magento into wp to then use something along the lines of...
    <?php if (sizeof($cart) > 1)) : ?>
    <a href="link">link to cart</a>
    <?php endif ?>

Share This Page