WC_Order::get_date_paid()
Get date paid.
Method of the class: WC_Order{}
Hooks from the method
Return
WC_DateTime|NULL
. object if the date is set or null if there is no date.
Usage
$WC_Order = new WC_Order(); $WC_Order->get_date_paid( $context );
- $context(string)
- What the value is for. Valid values are view and edit.
Default: 'view'
WC_Order::get_date_paid() WC Order::get date paid code 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; }