Woocommerce Cart not showing breakdown of items

I’m trying to figure out how I can show the breakdown of items in my cart. Right now it’s only showing the total number of items and total price.

This is the code that I have applied based on the documents.

<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>

Here is the screenshot of output.

enter image description here

The cart is using AJAX to update the cart without refreshing.

/* ------------------------------------------------------------------------ *
 *  AJAXIFY CART CONTENTS
 * ------------------------------------------------------------------------ */
    // Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
    add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
    function woocommerce_header_add_to_cart_fragment( $fragments ) {
    	ob_start();
    	?>
    	<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
    	<?php

    	$fragments['a.cart-contents'] = ob_get_clean();

    	return $fragments;
    }

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.