• Resolved jamieh16

    (@jamieh16)


    Hello,

    I’m displaying the number of contents in my cart inside of Woocommerce using the following:

    <?php if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { $count = WC()->cart->cart_contents_count; ?>
        					<a href="<?php echo WC()->cart->get_cart_url(); ?>">
        						<?php if ( $count > 0 ) echo '(' . $count . ')'; ?>
        					</a>
    					<?php } ?>

    But what I’d also like to do is show this same value on PHP pages outside of WordPress and outside of WooCommerce.

    Is this possible?

    Thanks!

    Jamie

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cart Count outside Woocommerce’ is closed to new replies.