Home›Support›English Support›[Resolved] Strings not translating on Thank you page (only if "Look for strings" enabled)
[Resolved] Strings not translating on Thank you page (only if "Look for strings" enabled)
This thread is resolved. Here is a description of the problem and solution.
Problem: After updating WooCommerce to version 8.7.0, string translations on the Thank You page stopped working, although they worked before. The client tried scanning for strings, deleting and re-adding them, clearing WPML cache, and disabling WP Rocket cache. The temporary solution was to enable 'Look for strings while pages are rendered', but the issue persisted when this option was disabled. Translations worked fine on other pages like Checkout and Cart.
Solution: We updated the String Translation plugin and generated the MO files again using the troubleshooting screen. After this update, the string translations appeared to work correctly in both the main and secondary languages. We asked the client to test the solution and report back if any issues remained.
If you're experiencing a similar issue, we recommend updating the String Translation plugin and regenerating the MO files through the troubleshooting screen. However, this solution might be outdated or not applicable to your case. If the problem persists, please check the related known issues, verify the version of the permanent fix, and ensure you have the latest versions of themes and plugins installed. If you still need assistance, we encourage you to open a new support ticket in the WPML support forum.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
After update to newest Woocommerce Version to 8.7.0 the string translation on the the Thank you page don't work anymore (worked before).
What I tried:
- Theme and plugins localization: Scan for strings for all themes and plugins (no new strings found)
- Delete strings and add them again
- Use Troubleshoot: Clear WPML Cache and Show custom MO Files Pre-generation dialog box -> generate
- Disabled the WP Rocket and cleared all Cache
The only thing that helped showing the existing string translations of the woocommerce and Theme textdomains was to enable "Look for strings while pages are rendered". As soon as I disable it, the translations disappear.
On other pages (Checkout, Cart etc.) the string translation works fine
I have no more ideas what I could try to solve this issue.
This is the code of my customer thankyou.php in the Child Theme:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
//Show the Correct Payment method for ABA Payway KHQR
if ( $order->get_meta('selected_payment_method', true) === 'payment_method_abapay_khqr') {
// Replace payment method title with 'ABA KHQR'
$order->payment_method_title = 'ABA KHQR';
}
?>
<div class="woocommerce-box">
<?php if ( $order ) : ?>
<?php if ( $order->has_status( 'failed' ) ) : ?>
<p><?php esc_html_e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction.', 'adventure-tours' ); ?></p>
<p><?php
if ( is_user_logged_in() )
esc_html_e( 'Please attempt your purchase again or go to your account page.', 'adventure-tours' );
else
esc_html_e( 'Please attempt your purchase again.', 'adventure-tours' );
?></p>
<p>
<a href="<?php echo esc_url( $order->get_checkout_payment_url() ); ?>" class="button pay"><?php esc_html_e( 'Pay', 'adventure-tours' ) ?></a>
<?php if ( is_user_logged_in() ) : ?>
<a href="<?php echo esc_url( wc_get_page_permalink( 'myaccount' ) ); ?>" class="button pay"><?php esc_html_e( 'My Account', 'adventure-tours' ); ?></a>
<?php endif; ?>
</p>
<?php else : ?>
<div class="icons-set__item__field--fix-size" style="text-align:center; margin: 20px auto;">
<div class="icons-set__item__icon-wrap" style="width: 100px; height: 100px; font-size: 18px;"><i class="icons-set__item__icon fa fa-calendar-check-o"></i></div>
</div>
<h2 style="text-align:center;"><?php echo apply_filters( 'woocommerce_thankyou_order_headline_new', esc_html__( 'BOOKING CONFIRMATION', 'adventure-tours' ), $order ); ?></h2>
<div style="text-align:left; max-width: 650px; margin: 0 auto;"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Thank you for choosing our services! Your booking has been received. A confirmation mail has been sent to you. (please also check your SPAM folder). We are looking forward to an amazing tour with you and we will contact you to let you know the contact details of your guide.', 'adventure-tours' ), $order ); ?></div>
<div class="title title--big title--underline title--decoration-bottom-left"></div>
<br/>
<ul class="order_details">
<?php
/*Variation Items
$items = $order->get_items();
foreach( $items as $item ) {
//returns the type (i.e. variable or simple)
$type = $item->get_type();
//the product id, always, no matter what type of product
$product_id = $item->get_product_id();
//a default
$variation_id = $item->get_variation_id();
}
$product = wc_get_product($product_id);
$variation = new WC_Product_Variation($variation_id);
*/
/*Get the USD Price*/
$total= $order->total;
$order_currency = $order->currency;
$wcml_settings = get_option('_wcml_settings');
/* var_export($wcml_settings); */
$rate = 1/$wcml_settings['currency_options']['EUR']['rate'];
$USD_price = round($total * $rate,0);
/*END Get the USD Price*/
printf('<li class="order">%s<strong>%s</strong></li>',
esc_html__( 'Order Number:', 'adventure-tours' ),
$order->get_order_number()
);
printf('<li class="date">%s<strong>%s</strong></li>',
esc_html__( 'Date:', 'adventure-tours' ),
date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) )
);
printf('<li class="total">%s<strong>%s</strong></li>',
esc_html__( 'Total:', 'adventure-tours' ),
$order->get_formatted_order_total()
);
/*Add USD Price*/
if($order_currency === "EUR"){
printf('<li class="total">%s<strong>$%s</strong></li>',
esc_html__( 'Total (USD):', 'adventure-tours' ),
$USD_price
);
}
/*End Add USD Price*/
if ( $order->payment_method_title ) {
printf('<li class="method">%s<strong>%s</strong></li>',
esc_html__( 'Payment Method:', 'adventure-tours' ),
$order->payment_method_title
);
}
?>
</ul>
<div class="clear"></div>
<?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php do_action( 'woocommerce_thankyou', $order->id ); ?>
<?php else : ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Thank you. Your order has been received.', 'adventure-tours' ), null ); ?></p>
<?php endif; ?>
</div>
One more detail:
Tried to use the default thankyou.php from woocommerce templates. Same result. no translation except when "Look for strings while pages are rendered" is enabled.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello,
I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Please, let me know if you need any additional details. Have a nice day.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
I noticed that there was an update available for String Translation.
I updated it and generated the MO files once more in the troubleshooting screen and now when I check it, it seems to be working properly in the main language and in the secondary language as well, please check the screenshots.
Please test it again and let us know if you're still facing any issues.
Thanks for your support. Where can I find the string translation update for solving this issue in the future as it wasn't visible in the WordPress Updates till now?
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
Sorry for the delay with this, the ticket had been marked as resolved, I just ended up seeing your reply.
There are two places where you can see the updates:
Alternative #1:
- Inside your wp-admin please go to Dashboard -> Updates.
- Then click on the "Check again" button.
- The plugins with updates available will show in there
Alternative #2:
- Inside your wp-admin please go to Plugins -> Add New.
- Then click on the "Commercial" tab and click on the "Check for updates" button in the WPML section
- After that please select every red plugin available in the list and then click on "Download" at the bottom of the grid.