Show number of items already in cart on category page Woocommerce

Hey everyone,

On the cateogory page in the Twenty twenty-four theme it shows the number of items on a product when a product is already in cart.

This screen shows what i mean. “In Winkelwagen” = the “In cart” button.
Here i have this product 4 times in cart.

screenshot-staging.local

Maybe this is possible with something like <?php echo WC()->cart->get_cart_contents_count() ?>, but i am not sure. In combination with the Bricks AJAX function turned on.