WC_Checkout::get_posted_address_data( string $key, string $type = 'billing' )

Get a posted address field after sanitization and validation.


Description Description


Parameters Parameters

$key

(Required) Field key.

$type

(Optional) Type of address. Available options: 'billing' or 'shipping'.

Default value: 'billing'


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-checkout.php

	public function get_posted_address_data( $key, $type = 'billing' ) {
		if ( 'billing' === $type || false === $this->legacy_posted_data['ship_to_different_address'] ) {
			$return = isset( $this->legacy_posted_data[ 'billing_' . $key ] ) ? $this->legacy_posted_data[ 'billing_' . $key ] : '';
		} else {
			$return = isset( $this->legacy_posted_data[ 'shipping_' . $key ] ) ? $this->legacy_posted_data[ 'shipping_' . $key ] : '';
		}
		return $return;
	}

Top ↑

User Contributed Notes User Contributed Notes

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