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

Filter hook 'woocommerce_thankyou_order_received_text' is escaping HTML #40352

Closed
5 tasks done
YordanSoares opened this issue Sep 21, 2023 · 2 comments
Closed
5 tasks done
Assignees
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. team: Proton type: community contribution

Comments

@YordanSoares
Copy link
Contributor

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

After merging #39758, any HTML passed though the woocommerce_thankyou_order_received_text filter hook is being escaped:

Expected behavior

Before merging #39758, it was possible to pass HTML code through this filter. This is very useful to add links or any other HTML code. This HTML code should be rendered correctly.

Actual behavior

Any HTML passed though the 'woocommerce_thankyou_order_received_text' filter hook is being escaped:

Steps to reproduce

  1. Activate this code snippet in your site:
add_filter('woocommerce_thankyou_order_received_text', 'wc_test_thank_you_link', 10, 2);
function wc_test_thank_you_link( $text, $order ) {
    $text .= '<p><a href="https://example.com">Click here</a></p>';
    return $text;
}
  1. Place a new order and check the code displayed after "Thank you. Your order has been received.", which should look like this:

    image

WordPress Environment

WordPress address (URL): https://woocommerce-testing.local
Site address (URL): https:///woocommerce-testing.local
WC Version: 8.1.1
REST API Version: ✔ 8.1.1
WC Blocks Version: ✔ 10.9.3
Action Scheduler Version: ✔ 3.6.2
Log Directory Writable: ✔
WP Version: 6.3.1
WP Multisite: –
WP Memory Limit: 256 MB
WP Debug Mode: ✔
WP Cron: ✔
Language: en_US
External object cache: –

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@tatof
Copy link

tatof commented Sep 22, 2023

Same! please remove the esc_html tag from the template file :-)

More with same problem: https://wordpress.org/support/topic/woocommerce_thankyou_order_received_text-doesnt-render-html/#post-17070696

@lsinger lsinger added priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. team: Proton and removed status: awaiting triage This is a newly created issue waiting for triage. labels Sep 22, 2023
@lsinger lsinger self-assigned this Sep 22, 2023
lsinger added a commit that referenced this issue Sep 25, 2023
…40353)

* Escape the default "Thank you" text instead of the filtered message

Closes: #40329 and #40352

* Update plugins/woocommerce/templates/checkout/order-received.php

Co-authored-by: Leif Singer <github.2017@singer.sh>

* Bump template version to 8.3.0

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: Leif Singer <github.2017@singer.sh>
Co-authored-by: github-actions <github-actions@github.com>
@lsinger
Copy link
Contributor

lsinger commented Sep 25, 2023

Resolved by #40353. ✅

@lsinger lsinger closed this as completed Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. team: Proton type: community contribution
Projects
None yet
3 participants