WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_Order::maybe_set_date_paid() public WC 3.0.0

Maybe set date paid.

Ищем WP-разработчика! Фулл-тайм, удаленка, хорошая зарплата, соц. пакет. Подробности.
Компания Boosta.

Sets the date paid variable when transitioning to the payment complete order status. This is either processing or completed. This is not filtered to avoid infinite loops e.g. if loading an order via the filter.

Date paid is set once in this manner - only when it is not already set. This ensures the data exists even if a gateway does not use the payment_complete method.

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

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

Возвращает

null. Ничего.

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

$WC_Order = new WC_Order();
$WC_Order->maybe_set_date_paid();

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

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

Код WC_Order::maybe_set_date_paid() WC 5.8.0

public function maybe_set_date_paid() {
	// This logic only runs if the date_paid prop has not been set yet.
	if ( ! $this->get_date_paid( 'edit' ) ) {
		$payment_completed_status = apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id(), $this );

		if ( $this->has_status( $payment_completed_status ) ) {
			// If payment complete status is reached, set paid now.
			$this->set_date_paid( time() );

		} elseif ( 'processing' === $payment_completed_status && $this->has_status( 'completed' ) ) {
			// If payment complete status was processing, but we've passed that and still have no date, set it now.
			$this->set_date_paid( time() );
		}
	}
}