WordPress at Your Fingertips
function is not described

wc_load_persistent_cart() WC 1.0

Deprecated from version 2.3. It is no longer supported and can be removed in future releases. It is recommended to replace this function with the same one.

Load the persistent cart.

Hooks from the function

Return

null. Nothing.

Usage

wc_load_persistent_cart( $user_login, $user );
$user_login(string) (required)
User login.
$user(WP_User) (required)
User data.

Changelog

Deprecated 2.3

Code of wc_load_persistent_cart() WC 6.1.0

function wc_load_persistent_cart( $user_login, $user ) {
	if ( ! $user || ! apply_filters( 'woocommerce_persistent_cart_enabled', true ) ) {
		return;
	}

	$saved_cart = get_user_meta( $user->ID, '_woocommerce_persistent_cart_' . get_current_blog_id(), true );

	if ( ! $saved_cart ) {
		return;
	}

	$cart = WC()->session->cart;

	if ( empty( $cart ) || ! is_array( $cart ) || 0 === count( $cart ) ) {
		WC()->session->cart = $saved_cart['cart'];
	}
}