Automattic\WooCommerce\StoreApi\Schemas\V1\Agentic

CheckoutSessionSchema::format_fulfillment_address_from_orderprotectedWC 1.0

Format fulfillment address from order.

Method of the class: CheckoutSessionSchema{}

No Hooks.

Returns

Array|null. Address data or null.

Usage

// protected - for code of main (parent) or child class
$result = $this->format_fulfillment_address_from_order( $order );
$order(WC_Order) (required)
Order object.

CheckoutSessionSchema::format_fulfillment_address_from_order() code WC 10.7.0

protected function format_fulfillment_address_from_order( $order ) {
	if ( ! $order->get_shipping_address_1() ) {
		return null;
	}

	return $this->build_address_array(
		$order->get_shipping_first_name(),
		$order->get_shipping_last_name(),
		$order->get_shipping_address_1(),
		$order->get_shipping_address_2(),
		$order->get_shipping_city(),
		$order->get_shipping_state(),
		$order->get_shipping_country(),
		$order->get_shipping_postcode()
	);
}