Skip to content

Fixed Function in klarnapay.php#421

Merged
vildanbina merged 1 commit intobuckaroo-it:developfrom
DAnn2012:patch-2
Oct 6, 2025
Merged

Fixed Function in klarnapay.php#421
vildanbina merged 1 commit intobuckaroo-it:developfrom
DAnn2012:patch-2

Conversation

@DAnn2012
Copy link
Copy Markdown
Contributor

@DAnn2012 DAnn2012 commented Oct 5, 2025

Fixed Function in klarnapay.php

@vildanbina
Copy link
Copy Markdown
Collaborator

@DAnn2012 what’s the purpose of this PR? I don’t see that it addresses any specific issue or provides a clear improvement

@DAnn2012
Copy link
Copy Markdown
Contributor Author

DAnn2012 commented Oct 6, 2025

Hi @vildanbina ,

I just submitted a PR that includes a small but important change to the way the error message is rendered for unsupported payment methods by country.

Previously, the code used:

esc_html_e('Payment method is not supported for country ', 'wc-buckaroo-bpe-gateway') . '(' . esc_html_e($country) . ')';

This line attempts to concatenate two calls to esc_html_e(), which directly echoes the translated string. However, since esc_html_e() doesn't return a value, the concatenation doesn't work as intended and may result in unexpected output or missing content.

I've updated it to:

echo esc_html__('Payment method is not supported for country ', 'wc-buckaroo-bpe-gateway') . '(' . esc_html($country) . ')';

This version correctly uses esc_html__() to retrieve the translated string and then echoes the full message, including the sanitized country name. It ensures proper localization and safe HTML output.

Let me know if you have any questions or suggestions!

Best regards.

@vildanbina
Copy link
Copy Markdown
Collaborator

@DAnn2012 great! Thanks for clarifying that

@vildanbina vildanbina merged commit 2f86a1d into buckaroo-it:develop Oct 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants