Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide fallback for email payment method title #7108

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/fix-6951-validate-set-title-for-email
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fix
Comment: Minor bug fix only adding a defensive check


10 changes: 9 additions & 1 deletion includes/payment-methods/class-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1166,9 +1166,17 @@ public function maybe_filter_gateway_title( $title, $id ) {
* Sets the payment method title on the order for emails.
*
* @param WC_Order $order WC Order object.
*
* @return void
*/
public function set_payment_method_title_for_email( $order ) {
$payment_method_id = $this->order_service->get_payment_method_id_for_order( $order );
$payment_method_id = $this->order_service->get_payment_method_id_for_order( $order );
if ( ! $payment_method_id ) {
$order->set_payment_method_title( $this->title );
$order->save();

return;
}
$payment_method_details = $this->payments_api_client->get_payment_method( $payment_method_id );
$payment_method_type = $this->get_payment_method_type_from_payment_details( $payment_method_details );
$this->set_payment_method_title_for_order( $order, $payment_method_type, $payment_method_details );
Expand Down