WC_Order::get_date_paid()publicWC 1.0

Get date paid.

Метод класса: WC_Order{}

Хуки из метода

Возвращает

WC_DateTime|NULL. object if the date is set or null if there is no date.

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

$WC_Order = new WC_Order();
$WC_Order->get_date_paid( $context );
$context(строка)
What the value is for. Valid values are view and edit.
По умолчанию: 'view'

Код WC_Order::get_date_paid() WC 9.6.1

public function get_date_paid( $context = 'view' ) {
	$date_paid = $this->get_prop( 'date_paid', $context );

	if ( 'view' === $context && ! $date_paid && version_compare( $this->get_version( 'edit' ), '3.0', '<' )
		/**
		 * Filters the order status to set after payment complete.
		 *
		 * @param string   $status        Order status.
		 * @param int      $order_id      Order ID.
		 * @param WC_Order $this          Order object.
		 * @since 3.0.0
		 */
		&& $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? OrderStatus::PROCESSING : OrderStatus::COMPLETED, $this->get_id(), $this ) ) ) {
		// In view context, return a date if missing.
		$date_paid = $this->get_date_created( 'edit' );
	}
	return $date_paid;
}