WC_Customer::get_shipping()publicWC 3.2.0

Get shipping.

Method of the class: WC_Customer{}

Hooks from the method

Return

Array.

Usage

$WC_Customer = new WC_Customer();
$WC_Customer->get_shipping( $context );
$context(string)
What the value is for. Valid values are 'view' and 'edit'.
Default: 'view'

Changelog

Since 3.2.0 Introduced.

WC_Customer::get_shipping() code WC 8.7.0

public function get_shipping( $context = 'view' ) {
	$value = null;
	$prop  = 'shipping';

	if ( array_key_exists( $prop, $this->data ) ) {
		$changes = array_key_exists( $prop, $this->changes ) ? $this->changes[ $prop ] : array();
		$value   = array_merge( $this->data[ $prop ], $changes );

		if ( 'view' === $context ) {
			$value = apply_filters( $this->get_hook_prefix() . $prop, $value, $this );
		}
	}

	return $value;
}