WC_Customer_Data_Store_Session::save_to_session( WC_Customer $customer )

Saves all customer data to the session.


Description Description


Parameters Parameters

$customer

(Required) Customer object.


Top ↑

Source Source

File: includes/data-stores/class-wc-customer-data-store-session.php

	public function save_to_session( $customer ) {
		$data = array();
		foreach ( $this->session_keys as $session_key ) {
			$function_key = $session_key;
			if ( 'billing_' === substr( $session_key, 0, 8 ) ) {
				$session_key = str_replace( 'billing_', '', $session_key );
			}
			$data[ $session_key ] = (string) $customer->{"get_$function_key"}( 'edit' );
		}
		WC()->session->set( 'customer', $data );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.