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.5.1

apply_filters('woocommerce_payment_complete_order_status') is found 5 times:

  • /includes/class-wc-order.php line 168
    				 * @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 349
    			 * @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 944
    			 * @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 188
    	 * @param WC_Order $order Order object.
    	 */
    	public function update( &$order ) {
    		// 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 ) ) ) {
    			$order->set_date_paid( $order->get_date_created( 'edit' ) );
    		}
    
    		// Also grab the current status so we can compare.
    		$previous_status = get_post_status( $order->get_id() );
    		// If the order doesn't exist in the DB, we will consider it as new.
    
  • /src/Internal/DataStores/Orders/OrdersTableDataStore.php line 2671
    		// 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: