Sunday, 11 October 2015

Function For Cart Icon Woo-Commerce


function getCartIcon(){
    global $woocommerce;

    // get cart quantity
    $qty = $woocommerce->cart->get_cart_contents_count();

    // get cart total
    $total = $woocommerce->cart->get_cart_total();

    // get cart url
    $cart_url = $woocommerce->cart->get_cart_url();

    // if multiple products in cart
    if($qty>1)
          echo 'Cart'.$qty.' products | '.$total.'';

    // if single product in cart
    if($qty==1)
          echo 'Cart1 product | '.$total.'';
}

No comments:

Post a Comment