0

Could someone help me with this syntax:

At the moment I have a simple link to my shopping cart like this:

<?php if ( is_woocommerce_activated() && isset( $woo_options['woocommerce_header_cart_link'] ) && 'true' ==     $woo_options['woocommerce_header_cart_link'] ) { ?>

And I want to add the condition to show my mini-cart when contents are greater than 0. I found the code below, but I can't figure out where to put this condition in the line above.

<!-- <?php
    if ( is_woocommerce_activated() && sizeof( $woocommerce->cart->cart_contents ) !== 0) {
        appply_mini_cart();
    }
    ?> -->

I would appreciate some guidance! Thanks

1 Answer 1

0

Just add another AND (&&) clause to the end of it.

<?php if ( is_woocommerce_activated() && isset( $woo_options['woocommerce_header_cart_link'] ) && 'true' ==     $woo_options['woocommerce_header_cart_link'] && sizeof( $woocommerce->cart->cart_contents ) !== 0) {...}

Probably best to take a look at some of the PHP tutorials or documentation around as you will be coming up against this type of syntax regularly.

1
  • You're quite right Pieter - I keep coming short and getting errors because of my weakness in this area! Thanks joersk.
    – RexTheRunt
    Sep 11, 2014 at 16:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.