woocommerce_new_order

woocommerce_new_order

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

See hook in core

Displaying hooks found in version: woocommerce.9.4.2

do_action('woocommerce_new_order') is found 4 times:

  • /includes/data-stores/class-wc-order-data-store-cpt.php line 111
    		if ( in_array( $order->get_status( 'edit' ), array( 'auto-draft', 'draft', 'checkout-draft' ), true ) ) {
    			return;
    		}
    
    		do_action( 'woocommerce_new_order', $order->get_id(), $order );
    	}
    
    	/**
    	 * Read order data. Can be overridden by child classes to load other props.
    	 *
    	 * @param WC_Order $order Order object.
    
  • /includes/data-stores/class-wc-order-data-store-cpt.php line 216
    			$current_status !== $previous_status
    			&& ! in_array( $current_status, $draft_statuses, true )
    			&& in_array( $previous_status, $draft_statuses, true )
    		) {
    			do_action( 'woocommerce_new_order', $order->get_id(), $order );  // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    			return;
    		}
    
    		do_action( 'woocommerce_update_order', $order->get_id(), $order );  // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    	}
    
    
  • /src/Internal/DataStores/Orders/OrdersTableDataStore.php line 2539
    		 *
    		 * @param int       Order ID.
    		 * @param \WC_Order Order object.
    		 */
    		do_action( 'woocommerce_new_order', $order->get_id(), $order );
    	}
    
    	/**
    	 * Helper method responsible for persisting new data to order table.
    	 *
    	 * This should not contain and specific meta or actions, so that it can be used other order types safely.
    
  • /src/Internal/DataStores/Orders/OrdersTableDataStore.php line 2633
    			&& $changes['status'] !== $previous_status
    			&& ! in_array( $changes['status'], $draft_statuses, true )
    			&& in_array( $previous_status, $draft_statuses, true )
    		) {
    			do_action( 'woocommerce_new_order', $order->get_id(), $order ); // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
    			return;
    		}
    
    		// For backwards compat with CPT, trashing/untrashing and changing previously datastore-level props does not trigger the update hook.
    		if ( ( ! empty( $changes['status'] ) && in_array( 'trash', array( $changes['status'], $previous_status ), true ) )
    			|| ( ! empty( $changes ) && ! array_diff_key( $changes, array_flip( $this->get_post_data_store_for_backfill()->get_internal_data_store_key_getters() ) ) ) ) {
    

See this hook used in plugins: