so I followed this to try and get data from WordPress to display outside the wordpress directory (n.b. I also needed to install the root cookie plugin):

How to use woocommerce functions outside of wordpress

Anyway, I’m trying to display the cart count, but keep getting “0” even though the cart has items:

<?php include ($_SERVER['DOCUMENT_ROOT']."/store/wp-load.php")?> 

<?php if (is_user_logged_in()){
    echo "Is logged in";
    echo "Is not";
} ?> <Br />

echo WC()->cart->get_cart_contents_count();


Is logged in 

Any ideas what I’m doing wrong?

Read more here: How to display woocommerce cart count outside wordpress framework


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: