Monday, 25 May 2015

get cart item name, quantity and all details in woocommerce

<?php
    global $woocommerce;
    $items = $woocommerce->cart->get_cart();

        foreach($items as $item => $values) {
            $_product = $values['data']->post;
            echo "<b>".$_product->post_title.'</b>  <br> Quantity: '.$values['quantity'].'<br>';
            $price = get_post_meta($values['product_id'] , '_price', true);
            echo "  Price: ".$price."<br>";
        }
?>

No comments:

Post a Comment