Fix - "Order received" page does not display the payment method information. (https://github.com/woocommerce/woocommerce-blocks/pull/9092)

* Fix - "Order received" page does not display the payment method information.

* changed fix approach by explicitly set payment method title.

---------

Co-authored-by: Niels Lange <info@nielslange.de>
This commit is contained in:
Dharmesh Patel 2023-04-19 16:53:20 +05:30 committed by GitHub
parent f92a4d8a13
commit dcaf20a7c9
1 changed files with 13 additions and 0 deletions

View File

@ -474,6 +474,7 @@ class Checkout extends AbstractCartRoute {
private function update_order_from_request( \WP_REST_Request $request ) {
$this->order->set_customer_note( $request['customer_note'] ?? '' );
$this->order->set_payment_method( $this->get_request_payment_method_id( $request ) );
$this->order->set_payment_method_title( $this->get_request_payment_method_title( $request ) );
wc_do_deprecated_action(
'__experimental_woocommerce_blocks_checkout_update_order_from_request',
@ -580,6 +581,18 @@ class Checkout extends AbstractCartRoute {
return is_null( $payment_method ) ? '' : $payment_method->id;
}
/**
* Gets the chosen payment method title from the request.
*
* @throws RouteException On error.
* @param \WP_REST_Request $request Request object.
* @return string
*/
private function get_request_payment_method_title( \WP_REST_Request $request ) {
$payment_method = $this->get_request_payment_method( $request );
return is_null( $payment_method ) ? '' : $payment_method->get_title();
}
/**
* Gets the chosen payment method from the request.
*