如何使用短代码的woocommerce数组?

By looking at this documentation https://docs.woothemes.com/wc-apidocs/class-WC_Cart.html it shows a lot of functions like

WC()->cart->check_cart_items();

which does work

Problem is when I try to print out array like in this case

$cart_contents

it just shows up as empty object

I did try to use

WC()->cart->init();

but result is the same. What could be the problem preventing from activating this object

You can use global woocommerce variable like this:

<?php 

    global $woocommerce;
    $items = $woocommerce->cart->get_cart();
    echo '<pre>';
    print_r($items);
    die;
?>