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

apply_filters('woocommerce_payment_complete_order_status') is found 5 times:

  • /includes/class-wc-order.php line 150
    				}
    				if ( ! $this->get_date_paid( 'edit' ) ) {
    					$this->set_date_paid( time() );
    				}
    				$this->set_status( apply_filters( 'woocommerce_payment_complete_order_status', $this->needs_processing() ? 'processing' : '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 323
    	 */
    	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' ) ) {
    
  • /includes/class-wc-order.php line 902
    	 */
    	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;
    	}
    
    
  • /includes/data-stores/class-wc-order-data-store-cpt.php line 180
    	 * @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() );
    
    
  • /src/Internal/DataStores/Orders/OrdersTableDataStore.php line 2477
    		// 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: