woocommerce_payment_complete_order_status

woocommerce_payment_complete_order_status

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: woocommerce.9.8.1

apply_filters('woocommerce_payment_complete_order_status') is found 5 times:

  • /includes/class-wc-order.php line 169
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
         * @param int      $order_id      Order ID.
         * @param WC_Order $this          Order object.
         * @since 2.7.0
         */
        $this->set_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? OrderStatus::PROCESSING : OrderStatus::COMPLETED, $this->get_id(), $this ) );
        $this->save();
     
        do_action( 'woocommerce_payment_complete', $this->get_id(), $transaction_id );
    } else {
        do_action( 'woocommerce_payment_complete_order_status_' . $this->get_status(), $this->get_id(), $transaction_id );
    }
  • /includes/class-wc-order.php line 350
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    * @param int      $order_id      Order ID.
     * @param WC_Order $this          Order object.
     * @since 2.7.0
     */
    $payment_completed_status = apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? OrderStatus::PROCESSING : OrderStatus::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 ( OrderStatus::PROCESSING === $payment_completed_status && $this->has_status( OrderStatus::COMPLETED ) ) {
  • /includes/class-wc-order.php line 945
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
             * @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;
    }
  • /includes/data-stores/class-wc-order-data-store-cpt.php line 199
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
         *
         * @param string   $payment_complete_status Default status to use when payment is complete.
         * @param int      $order_id               Order ID.
         */
        $payment_complete_status = apply_filters( 'woocommerce_payment_complete_order_status', $order->needs_processing() ? OrderStatus::PROCESSING : OrderStatus::COMPLETED, $order->get_id(), $order );
        if ( $order->has_status( $payment_complete_status ) ) {
            $order->set_date_paid( $order->get_date_created( 'edit' ) );
        }
    }
     
    // Also grab the current status so we can compare.
  • /src/Internal/DataStores/Orders/OrdersTableDataStore.php line 2800
    2796
    2797
    2798
    2799
    2800
    2801
    2802
    2803
    2804
    2805
    2806
    // Before updating, ensure date paid is set if missing.
    if (
        ! $order->get_date_paid( 'edit' )
        && version_compare( $order->get_version( 'edit' ), '3.0', '<' )
        && $order->has_status( apply_filters( 'woocommerce_payment_complete_order_status', $order->needs_processing() ? 'processing' : 'completed', $order->get_id(), $order ) ) // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    ) {
        $order->set_date_paid( $order->get_date_created( 'edit' ) );
    }
     
    if ( null === $order->get_date_created( 'edit' ) ) {
        $order->set_date_created( time() );

See this hook used in plugins: