WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Получай пассивный доход от сайта с помощью браузерных PUSH уведомлений
функция не описана

WC_Order_Data_Store_CPT::read_order_data() protected WC 3.0.0

Read order data. Can be overridden by child classes to load other props.

{} Это метод класса: WC_Order_Data_Store_CPT{}

Хуков нет.

Возвращает

null. Ничего.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->read_order_data( $order, $post_object );
$order(WC_Order) (обязательный)
Order object.
$post_object(объект) (обязательный)
Post object.

Список изменений

С версии 3.0.0 Введена.

Код WC_Order_Data_Store_CPT::read_order_data() WC 5.3.0

<?php
protected function read_order_data( &$order, $post_object ) {
	parent::read_order_data( $order, $post_object );
	$id             = $order->get_id();
	$date_completed = get_post_meta( $id, '_date_completed', true );
	$date_paid      = get_post_meta( $id, '_date_paid', true );

	if ( ! $date_completed ) {
		$date_completed = get_post_meta( $id, '_completed_date', true );
	}

	if ( ! $date_paid ) {
		$date_paid = get_post_meta( $id, '_paid_date', true );
	}

	$order->set_props(
		array(
			'order_key'            => get_post_meta( $id, '_order_key', true ),
			'customer_id'          => get_post_meta( $id, '_customer_user', true ),
			'billing_first_name'   => get_post_meta( $id, '_billing_first_name', true ),
			'billing_last_name'    => get_post_meta( $id, '_billing_last_name', true ),
			'billing_company'      => get_post_meta( $id, '_billing_company', true ),
			'billing_address_1'    => get_post_meta( $id, '_billing_address_1', true ),
			'billing_address_2'    => get_post_meta( $id, '_billing_address_2', true ),
			'billing_city'         => get_post_meta( $id, '_billing_city', true ),
			'billing_state'        => get_post_meta( $id, '_billing_state', true ),
			'billing_postcode'     => get_post_meta( $id, '_billing_postcode', true ),
			'billing_country'      => get_post_meta( $id, '_billing_country', true ),
			'billing_email'        => get_post_meta( $id, '_billing_email', true ),
			'billing_phone'        => get_post_meta( $id, '_billing_phone', true ),
			'shipping_first_name'  => get_post_meta( $id, '_shipping_first_name', true ),
			'shipping_last_name'   => get_post_meta( $id, '_shipping_last_name', true ),
			'shipping_company'     => get_post_meta( $id, '_shipping_company', true ),
			'shipping_address_1'   => get_post_meta( $id, '_shipping_address_1', true ),
			'shipping_address_2'   => get_post_meta( $id, '_shipping_address_2', true ),
			'shipping_city'        => get_post_meta( $id, '_shipping_city', true ),
			'shipping_state'       => get_post_meta( $id, '_shipping_state', true ),
			'shipping_postcode'    => get_post_meta( $id, '_shipping_postcode', true ),
			'shipping_country'     => get_post_meta( $id, '_shipping_country', true ),
			'payment_method'       => get_post_meta( $id, '_payment_method', true ),
			'payment_method_title' => get_post_meta( $id, '_payment_method_title', true ),
			'transaction_id'       => get_post_meta( $id, '_transaction_id', true ),
			'customer_ip_address'  => get_post_meta( $id, '_customer_ip_address', true ),
			'customer_user_agent'  => get_post_meta( $id, '_customer_user_agent', true ),
			'created_via'          => get_post_meta( $id, '_created_via', true ),
			'date_completed'       => $date_completed,
			'date_paid'            => $date_paid,
			'cart_hash'            => get_post_meta( $id, '_cart_hash', true ),
			'customer_note'        => $post_object->post_excerpt,
		)
	);
}