Error on Order Thank You Page
-
I’m having issues with a SPAN ID tag being shown on the order thankyou page that’s displayed following an order submission. I’ve tried all ways to edit it, including editing the file directly, but no luck.
Is there a way to hide this text using css?
-
Same issue here, the Google Analytics and Microsoft Bing tracking codes are being displayed on the “Order received” page. It looks like it’s picking up stuff added to wp_head and then runs it through esc_html(). Perhaps an errant filter?
If you see a SPAN ID or tracking code displayed on the Order Received page, it might be due to a conflict with a plugin or theme.
To hide the SPAN ID, you can indeed use CSS. You would need to find the specific ID or class of the element you want to hide and then add a CSS rule to hide it.
For example, if the SPAN ID is “tracking-code”, you could add this to your site’s CSS:
#tracking-code { display: none; }
As for the tracking codes appearing on the page, this is not typical behavior and may be caused by a conflict. I recommend running a conflict test to see if disabling any plugins or switching to a default theme resolves the issue. You can find a detailed explanation of conducting a conflict test here.
I hope this helps! Please let us know how it goes or if you need further assistance.
Thanks for the reply. I have tried all combinations with css to try and hide this but with no luck. I am adding the css in the template theme additional css area.
Have tried;
.woocommerce span.additional-content {
display: none !important; }.woocommerce span.thank-you__additional-content {
display: none !important; }#thank-you__additional-content {
display: none !important; }span.thank-you__additional-content {
display: none !important; }Using chrome inspector, the code looks like this;
<p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"> Thank you. Your order has been received. We have emailed the purchase receipt to you. <span id="thank-you__additional-content"></p>
@nluk100: that’s because it’s not a span within the document object model. It’s a snippet of HTML that has been converted to allow it to be displayed within the page by converting (for example) < into < and > into > so it’s absolutely NOT something that can be targeted by CSS. You were given incorrect information by support.
The comment about a plugin or theme conflict might be accurate, but I’ve not had time to investigate this yet.
Ok, thanks for chipping in. So I guess I would need to identify what plugin is causing this and edit the php file to remove the additional comments fields (I don’t use them anyway).
I wouldn’t suggest editing plugins, your changes would be lost when you update. I can see two possibilities:
- WooCommerce has an issue with the checkout. This could be verified by installing a vanilla copy of WordPress and a vanilla copy of WooCommerce and then testing the checkout process.
- WooCommerce and some other plugin(s) aren’t playing well together. This could be verified by individually disabling plugins on the affected website until the problem goes away.
I’m snowed under with a big project at the moment but will attempt both of the tests above when I get a chance.
-
This reply was modified 1 year, 4 months ago by
Matt Lowe.
I tried disabling all the plugins that are related to woocommerce and it’s still there.
I did find this code in the customer-processing-order.php file;
/** * Show user-defined additional content - this is set in each email's settings. */ if ( $additional_content ) { echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) ); }
I have an additional plugin called Email Template Customizer for WooCommerce installed too.
Hello @nluk100,
The following part doesn’t belong to WooCommerce, I searched all WooCommerce templates for it.<span id="thank-you__additional-content">
You can find the original message here.
If you don’t recall adding a snippet to yourfunctions.php
file to modify the message, then the problem is probably originating from your theme or another active plugin, as previously mentioned.
The best way to determine this is to:- Temporarily switch your theme to Storefront
- Disable all plugins except for Woo
- Repeat the action that is causing the problem
If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.
Let us know how it goes!
Sorry it’s taken me a while to look at this, I’ve been completely snowed under with a large project. The issue is that WooCommerce have changed the way that the “thank you” text is rendered:
$message = apply_filters( 'woocommerce_thankyou_order_received_text', esc_html( __( 'Thank you. Your order has been received.', 'woocommerce' ) ), $order );
That “esc_html()” call is stripping out HTML that has been added to the “woocommerce_thankyou_order_received_text” filter. It has changed between versions 8.2 and 8.3, before there was no call to esc_html().
A plugin or perhaps a code snippet within your theme will be adding HTML to the checkout thank you page by hooking the “woocommerce_thankyou_order_received_text” filter and, previously, it was possible to add arbitrary HTML to the returned text but now it is not.
The “easiest” way to determine which (not necessarily the quickest or most convenient though) is to disable plugins one by one until the thank you page stops showing the errant HTML snippet. If it’s not a plugin then try switching to a different theme. Once you’ve determined which plugin/theme is responsible you will need to go back to the developer to report the bug. They will need to find the code that adds that text, which will look something like:
add_filter( 'woocommerce_thankyou_order_received_text', …
Any HTML returned by the function will need stripping. In your case, where it looks like it’s just adding some formatting HTML, it shouldn’t cause you too many headaches.
In my case, however, I had been using it to inject Google Ads and Bing Ads conversion tracking scripts and so this change causes me a monumental headache. I will have to try and find another way to inject content into that particular page of the checkout in order to work around this frustrating change.
- The topic ‘Error on Order Thank You Page’ is closed to new replies.