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

ActionController::run_actionspublicWC 1.0

Run the actions for the order.

Метод класса: ActionController{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ActionController = new ActionController();
$ActionController->run_actions( $order, $request );
$order(WC_Order) (обязательный)
The order object.
$request(WP_REST_Request) (обязательный)
The request object.

Код ActionController::run_actions() WC 10.5.2

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() ) );
			}
		}
	}
}