Automattic\WooCommerce\Internal\RestApi\Routes\V4\Orders

ActionController::run_actionspublicWC 1.0

Run the actions for the order.

Method of the class: ActionController{}

No Hooks.

Returns

null. Nothing (null).

Usage

$ActionController = new ActionController();
$ActionController->run_actions( $order, $request );
$order(WC_Order) (required)
The order object.
$request(WP_REST_Request) (required)
The request object.

ActionController::run_actions() code WC 10.4.3

public function run_actions( WC_Order $order, WP_REST_Request $request ) {
	$valid_actions = array_keys( $this->get_endpoint_args_for_actions() );

	foreach ( $valid_actions as $action ) {
		$callback = 'action_' . $action;
		$param    = $request->get_param( $action );
		if ( null !== $param && is_callable( array( $this, $callback ) ) ) {
			$result = call_user_func( array( $this, $callback ), $param, $order, $request );

			if ( is_wp_error( $result ) ) {
				throw new WC_REST_Exception( 'woocommerce_rest_invalid_action', esc_html( $result->get_error_message() ) );
			}
		}
	}
}