WC_Order::get_date_paid( string $context = 'view' )
Get date paid.
Description Description
Parameters Parameters
- $context
-
(Optional) What the value is for. Valid values are view and edit.
Default value: 'view'
Return Return
(WC_DateTime|NULL) object if the date is set or null if there is no date.
Source Source
File: includes/class-wc-order.php
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', '<' ) && $this->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : 'completed', $this->get_id(), $this ) ) ) { // In view context, return a date if missing. $date_paid = $this->get_date_created( 'edit' ); } return $date_paid; }