WordPress at a glance
function is not described

WC_Cart::get_cart_contents_weight() public WC 2.5.0

Get weight of items in the cart.

{} It's a method of the class: WC_Cart{}

Hooks from the method
Return

float. Nothing.

Usage

$WC_Cart = new WC_Cart();
$WC_Cart->get_cart_contents_weight();

Changelog

Since 2.5.0 Introduced.

Code of WC_Cart::get_cart_contents_weight() WC 5.3.0

<?php
public function get_cart_contents_weight() {
	$weight = 0.0;

	foreach ( $this->get_cart() as $cart_item_key => $values ) {
		if ( $values['data']->has_weight() ) {
			$weight += (float) $values['data']->get_weight() * $values['quantity'];
		}
	}

	return apply_filters( 'woocommerce_cart_contents_weight', $weight );
}