WordPress at Your Fingertips
function is not described

WC_Cart::get_cart_hash() public WC 3.6.0

Returns the hash based on cart contents.

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

Return

String. hash for cart content

Usage

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

Changelog

Since 3.6.0 Introduced.

Code of WC_Cart::get_cart_hash() WC 5.6.0

public function get_cart_hash() {
	$cart_session = $this->session->get_cart_for_session();
	$hash         = $cart_session ? md5( wp_json_encode( $cart_session ) . $this->get_total( 'edit' ) ) : '';
	$hash         = apply_filters_deprecated( 'woocommerce_add_to_cart_hash', array( $hash, $cart_session ), '3.6.0', 'woocommerce_cart_hash' );

	return apply_filters( 'woocommerce_cart_hash', $hash, $cart_session );
}