WordPress at Your Fingertips
function is not described

WC_Cart_Session::get_saved_cart() private WC 3.5.0

Get the persistent cart from the database.

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

Hooks from the method

Return

Array.

Usage

// private - for code of main (parent) class only
$result = $this->get_saved_cart();

Changelog

Since 3.5.0 Introduced.

Code of WC_Cart_Session::get_saved_cart() WC 5.9.0

private function get_saved_cart() {
	$saved_cart = array();

	if ( apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) {
		$saved_cart_meta = get_user_meta( get_current_user_id(), '_woocommerce_persistent_cart_' . get_current_blog_id(), true );

		if ( isset( $saved_cart_meta['cart'] ) ) {
			$saved_cart = array_filter( (array) $saved_cart_meta['cart'] );
		}
	}

	return $saved_cart;
}