Automattic\WooCommerce\StoreApi\Routes\V1
Checkout::get_route_post_response
Process an order.
Метод класса: Checkout{}
Хуков нет.
Возвращает
\WP_REST_Response|\WP_Error.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_route_post_response( $request );
- $request(WP_REST_Request) (обязательный)
- .
Код Checkout::get_route_post_response() Checkout::get route post response WC 11.0.1
protected function get_route_post_response( \WP_REST_Request $request ) { // phpcs:ignore Squiz.Commenting.FunctionComment.IncorrectTypeHint
try {
return $this->process_order( $request );
} catch ( \Throwable $exception ) {
if ( $this->order ) {
// The optimistic order save bounced back, persist the order as it is to preserve the intermediate state.
try {
$this->order->save();
} catch ( \Throwable $save_exception ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
// Ignore the save exception, the root cause will be bubbled up via re-throwing $exception.
}
}
throw $exception;
}
}