why thank you page in woocommerce doesn't work properly? - php

why the ordered items doesn't appear in my thankyou pages? there is no invoice detail as usual.. i don't know why, now it's only a message only.. several weeks ago, invoice detail appears and can work properly..
i think the error code is at thankyou.php at woocommerce/checkout
i find that variable $order cannot be read, so the if clause is skipped to the else one.. then it only shows the messages in the bottom of codes in thankyou.php (below is the codes)
my goal is to show the invoice detail in my woocommerce thank you pages, not only the messages.
<?php
/**
* Thankyou page
*
* This template can be overridden by copying it to yourtheme/woocommerce/checkout/thankyou.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* #see https://docs.woocommerce.com/document/template-structure/
* #author WooThemes
* #package WooCommerce/Templates
* #version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( $order ) : ?>
<?php if ( $order->has_status( 'failed' ) ) : ?>
<p class="woocommerce-thankyou-order-failed"><?php _e( 'Pesaan Anda belum dapat kami proses sehubungan BANK Anda telah menolak transaksi. Silahkan coba melakukan pemesanan ulang.', 'woocommerce' ); ?></p>
<p class="woocommerce-thankyou-order-failed-actions">
<?php _e( 'Pay', 'woocommerce' ) ?>
<?php if ( is_user_logged_in() ) : ?>
<?php _e( 'My Account', 'woocommerce' ); ?>
<?php endif; ?>
</p>
<?php else : ?>
<p class="woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Terima kasih, Pemesanan Anda baru saja kami terima. Anda juga bisa melihat detail pemesanan melalui email yang kami kirimkan.', 'woocommerce' ), $order ); ?></p>
<ul class="woocommerce-thankyou-order-details order_details">
<li class="order">
<?php _e( 'Nomor Pesanan:', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="date">
<?php _e( 'Tanggal Pesan:', 'woocommerce' ); ?>
<strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
</li>
<li class="total">
<?php _e( 'Total Bayar:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->payment_method_title ) : ?>
<li class="method">
<?php _e( 'Cara Bayar:', 'woocommerce' ); ?>
<strong><?php echo $order->payment_method_title; ?></strong>
</li>
<?php endif; ?>
</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 class="woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Terima kasih. Pemesanan Anda baru saja Kami terima. Detail pemesanan dapat Anda lihat melalui email yang baru saja kami kirimkan. Anda bisa cek email sekarang. Bila tidak menemukan email, silahkan cek folder spam dan pindahkan ke bukan spam.', 'woocommerce' ), null ); ?></p>
<?php endif; ?>

Related

I want to add cancel order button in woocommerce template order details for guest users only?

We are using woocommerce order tracking shortcode.This is my woocommerce order tracking.php file. We track the order of guest users by order id and email.
can we add cancel order button here which can cancel the order of guest user.
<?php if ( $notes ) : ?>
<h2><?php esc_html_e( 'Order updates', 'woocommerce' ); ?></h2>
<ol class="commentlist notes">
<?php foreach ( $notes as $note ) : ?>
<li class="comment note">
<div class="comment_container">
<div class="comment-text">
<p class="meta"><?php echo date_i18n( esc_html__( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p>
<div class="description">
<?php echo wpautop( wptexturize( $note->comment_content ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</li>
<?php endforeach; ?>
</ol>
<?php
endif; ?>
<?php do_action( 'woocommerce_view_order', $order->get_id() ); ?>
This is the view of order details page.
Here i want to add cancel order button for guest users
Use woocommerce wc_get_account_orders_actions() function to get all woocommerce actions.
Add the following link in you tracking.php file and that's it
echo '<a href="'.$string.'" id="custom-cancel" class="woocommerce-button button' . sanitize_html_class( $key ) . '" >' .esc_html( $actions['cancel']['name'] ). '</a>';

Access first name of user in WooCommerce account acitivation mail (DOI via WooCommerce Germanized)

We have a custom registration page for our WooCommerce site which is based on a Business Bloomer shortcode and added an input field for the first name of the user. The code within our functions.php looks like this:
/**
* #snippet WooCommerce User Registration Shortcode
* #author Rodolfo Melogli
* #compatible WooCommerce 3.6.5
* #donate $9 https://businessbloomer.com/bloomer-armada/
*/
// THIS WILL CREATE A NEW SHORTCODE: [wc_reg_form_bbloomer]
add_shortcode('wc_reg_form_bbloomer', 'bbloomer_separate_registration_form');
function bbloomer_separate_registration_form()
{
if (is_admin()) return;
if (is_user_logged_in()) return;
ob_start();
// NOTE: THE FOLLOWING <FORM></FORM> IS COPIED FROM woocommerce\templates\myaccount\form-login.php
// IF WOOCOMMERCE RELEASES AN UPDATE TO THAT TEMPLATE, YOU MUST CHANGE THIS ACCORDINGLY
?>
<form method="post" class="woocommerce-form woocommerce-form-register register" <?php do_action('woocommerce_register_form_tag'); ?> >
<?php do_action('woocommerce_register_form_start'); ?>
<?php if ('no' === get_option('woocommerce_registration_generate_username')): ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_username"><?php esc_html_e('Username', 'woocommerce'); ?> <span class="required">*</span></label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="reg_username" autocomplete="username" value="<?php echo (!empty($_POST['username'])) ? esc_attr(wp_unslash($_POST['username'])) : ''; ?>" /><?php // #codingStandardsIgnoreLine
?>
</p>
<?php
endif; ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_email"><?php esc_html_e('Email address', 'woocommerce'); ?> <span class="required">*</span></label>
<input type="email" class="woocommerce-Input woocommerce-Input--text input-text" name="email" id="reg_email" autocomplete="email" value="<?php echo (!empty($_POST['email'])) ? esc_attr(wp_unslash($_POST['email'])) : ''; ?>" /><?php // #codingStandardsIgnoreLine
?>
</p>
<?php if ('no' === get_option('woocommerce_registration_generate_password')): ?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_password"><?php esc_html_e('Password', 'woocommerce'); ?> <span class="required">*</span></label>
<input type="password" class="woocommerce-Input woocommerce-Input--text input-text" name="password" id="reg_password" autocomplete="new-password" />
</p>
<?php
else: ?>
<p><?php esc_html_e('A password will be sent to your email address.', 'woocommerce'); ?></p>
<?php
endif; ?>
<?php do_action('woocommerce_register_form'); ?>
<p class="woocommerce-FormRow form-row">
<?php wp_nonce_field('woocommerce-register', 'woocommerce-register-nonce'); ?>
<button type="submit" class="woocommerce-Button woocommerce-button button woocommerce-form-register__submit" name="register" value="<?php esc_attr_e('Register', 'woocommerce'); ?>"><?php esc_html_e('Register', 'woocommerce'); ?></button>
</p>
<?php do_action('woocommerce_register_form_end'); ?>
</form>
<?php
return ob_get_clean();
}
/**
* #snippet Add First to Register Form - WooCommerce
* #sourcecode https://businessbloomer.com/?p=21974
* #author Rodolfo Melogli
* #credits Claudio SM Web
* #compatible WC 3.5.2
* #donate $9 https://businessbloomer.com/bloomer-armada/
*/
///////////////////////////////
// 1. ADD FIELDS
add_action( 'woocommerce_register_form_start', 'bbloomer_add_name_woo_account_registration' );
function bbloomer_add_name_woo_account_registration() {
?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" />
</p>
<div class="clear"></div>
<?php
}
///////////////////////////////
// 2. VALIDATE FIELDS
add_filter( 'woocommerce_registration_errors', 'bbloomer_validate_name_fields', 10, 3 );
function bbloomer_validate_name_fields( $errors, $username, $email ) {
if ( isset( $_POST['billing_first_name'] ) && empty( $_POST['billing_first_name'] ) ) {
$errors->add( 'billing_first_name_error', __( '<strong>Achtung</strong>: Vorname ist ein Pflichtfeld!', 'woocommerce' ) );
}
return $errors;
}
///////////////////////////////
// 3. SAVE FIELDS
add_action( 'woocommerce_created_customer', 'bbloomer_save_name_fields' );
function bbloomer_save_name_fields( $customer_id ) {
if ( isset( $_POST['billing_first_name'] ) ) {
update_user_meta( $customer_id, 'billing_first_name', sanitize_text_field( $_POST['billing_first_name'] ) );
update_user_meta( $customer_id, 'first_name', sanitize_text_field($_POST['billing_first_name']) );
}
}
Since our site is based in Germany we use the WooCommerce Germanized plugin with the DOI (double opt-in) functionality. So a user receives an activation mail which they have to click in order to active the account. Within the activation mail we want to have a more personal feeling, thus include the first name of the user. There we added the original email template from WooCommerce Germanized to our child theme.
The problem is that the only value I can access (is displayed in the actually delivered email) is $user_login which returns the automatically created username. How can I access the first name of the user which is saved as first name and billing first name. The template within our child theme looks like this:
<?php
/**
* Customer new account activation email.
*
* #see https://github.com/vendidero/woocommerce-germanized/wiki/Overriding-Germanized-Templates
* #package Germanized/Templates
* #version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
?>
<?php do_action( 'woocommerce_email_header', $email_heading, $email ); ?>
<p><?php printf( __( 'Hi %s,', 'woocommerce' ), esc_html( $user_login ) ); ?></p>
<p><?php printf( __( "Thanks for creating an account on %s. Please follow the activation link to activate your account:", 'woocommerce-germanized' ), esc_html( $blogname ) ); ?></p>
<p><a class="wc-button button"
href="<?php echo esc_url( $user_activation_url ); ?>"><?php _e( 'Activate your account', 'woocommerce-germanized' ); ?></a>
</p>
<?php if ( get_option( 'woocommerce_registration_generate_password' ) == 'yes' && $password_generated ) : ?>
<p><?php printf( __( "Your password has been automatically generated: <strong>%s</strong>", 'woocommerce-germanized' ), esc_html( $user_pass ) ); ?></p>
<?php endif; ?>
<p style="font-size:75%;"><?php printf( __( "If you haven't created an account on %s please ignore this email.", "woocommerce-germanized" ), esc_html( $blogname ) ); ?></p>
<p style="font-size:75%;"><?php printf( __( 'If you cannot follow the link above please copy this url and paste it to your browser bar: %s', 'woocommerce-germanized' ), esc_url( $user_activation_url ) ); ?></p>
<?php
/**
* Show user-defined additional content - this is set in each email's settings.
*/
if ( $additional_content ) {
echo wp_kses_post( wpautop( wptexturize( $additional_content ) ) );
}
?>
<?php do_action( 'woocommerce_email_footer', $email ); ?>
I already tried to populate the first name as described here (https://wordpress.org/support/topic/new-account-email-insert-first-name/) and to access it via $user->display_name but this did not work.
I also tried the solution provided here (Get user meta data from woocommerce_created_customer hook in Woocommerce) to access first name via Customer object. The code would then look like below. I didn't work either.
<p><?php $customer = new WC_Customer( $customer_id ); printf( __( 'Hi %s,', 'woocommerce' ), esc_html( $customer->get_first_name() ) ); ?></p>
Any help would be highly appreciated!
First you need to find the user. I assume you don't have access to the user ID, if you do you can skip the first line, and insert the user_id at the appropriate point.
Then you need to get the first name from the meta data. According to your code you store it in the metadata field 'billing_first_name'. And then it's a matter of inserting it in your email.
<?php
$the_user = get_user_by('login', $user_login);
$first_name = get_user_meta($the_user->ID, 'billing_first_name', true);
?>
<p><?php printf( __( 'Hi %s,', 'woocommerce' ), esc_html( $first_name ) ); ?></p>
Actually WooCommerce has that template on default, which includes username, email, myaccount url and much more, I dont think there will be difference between woc eng or grmn, except language.
defined('ABSPATH') || exit;
do_action('woocommerce_email_header', $email_heading, $email); ?>
//To get user_name on registration you need to call get_user_by('id',$user_login); OR get_user_by('login',$user_login); OR get_user_by('user_name',$user_login);
$user = get_user_by('id',$user_login);
$first_name = get_user_meta($user,'first_name',true);
//and call like this
<p><?php printf(esc_html__('Hi %s,', 'woocommerce'), esc_html($first_name)); ?></p>
//translators: %s: Customer username
<p><?php printf(esc_html__('Hi %s,', 'woocommerce'), esc_html( $user_login)); ?>
//translators: %1$s: Site title, %2$s: Username, %3$s: My account link
<p><?php printf(esc_html__('Thanks for creating an account on %1$s. Your username is %2$s. You can access your account area to view orders, change your password, and more at: %3$s', 'woocommerce'), esc_html($blogname), '<strong>' . esc_html( $user_login) . '</strong>', make_clickable(esc_url( wc_get_page_permalink('myaccount'))));
?></p>
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
<?php if ('yes' === get_option('woocommerce_registration_generate_password') && $password_generated) : ?>
//translators: %s: Auto generated password
<p><?php printf(esc_html__('Your password has been automatically generated: %s', 'woocommerce'), '<strong>' . esc_html($user_pass) .'</strong>'); ?></p>
<?php endif; ?>
<?php
//Show user-defined additional content - this is set in each email's settings
if ($additional_content) {
echo wp_kses_post(wpautop( wptexturize( $additional_content)));
}
do_action('woocommerce_email_footer', $email);
?>
Here is the template https://github.com/woocommerce/woocommerce/blob/master/templates/emails/customer-new-account.php
get the user information by login
$customer = get_user_by('login', $user_login);
and get the name using the user id
$firstName = get_user_meta($customer->ID,'billing_first_name',true);
if the user is not registered, so, you can use this
esc_html( $firstName ) );
instead to
esc_html( $customer->get_first_name() ) );

How do I remove billing address from the thank you page?

So I want to remove the billing address from the thank you page. I am using wordpress and have the theme Impreza.
I have targeted the .woocommerce-customer-details and set to display: none; which worked on the google inspector mode but saved and refreshed and it still shows up. And I have checked the woo-commerce template files and found the order-details-customer.php is generating the information. I added a class to remove that section but it still shows up.
Woocommerce thank you page
In theme find a folder named woocommerce if not exist then Create folder:
Copy this file
/wp-content/plugins/woocommerce/templates/checkout/thankyou.php
and paste it into your active theme directory something like this
/wp-content/themes/activetheme/woocommerce/checkout/thankyou.php
And remove this
<ul class="woocommerce-thankyou-order-details order_details">
<li class="order">
<?php _e( 'Order Number:', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="date">
<?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
</li>
<li class="total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->payment_method_title ) : ?>
<li class="method">
<?php _e( 'Payment Method:', 'woocommerce' ); ?>
<strong><?php echo $order->payment_method_title; ?></strong>
</li>
<?php endif; ?>
</ul>
<div class="clear"></div>
and also remove this
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php do_action( 'woocommerce_thankyou', $order->id ); ?>

Uncommenting in Woocommerce template

I don't have much experience with PHP and was wondering if anyone could help me uncomment a few lines from the Woocommerce thankyou.php template that can be found here: https://github.com/woocommerce/woocommerce/blob/master/templates/checkout/thankyou.php . I need to remove the order details starting line 43-77:
<ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
<li class="woocommerce-order-overview__order order">
<?php _e( 'Order number:', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="woocommerce-order-overview__date date">
<?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo wc_format_datetime( $order->get_date_created() ); ?></strong>
</li>
<li class="woocommerce-order-overview__total total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->get_payment_method_title() ) : ?>
<li class="woocommerce-order-overview__payment-method method">
<?php _e( 'Payment method:', 'woocommerce' ); ?>
<strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
<?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>
Thanks for your help!
This question is not clear. I think you want us to help you commenting a portion of code on that checkout/thankyou.php template, to remove some info from line 43 to 77…
So your template code will be:
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="woocommerce-order">
<?php if ( $order ) : ?>
<?php if ( $order->has_status( 'failed' ) ) : ?>
<p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed"><?php _e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce' ); ?></p>
<p class="woocommerce-notice woocommerce-notice--error woocommerce-thankyou-order-failed-actions">
<?php _e( 'Pay', 'woocommerce' ) ?>
<?php if ( is_user_logged_in() ) : ?>
<?php _e( 'My account', 'woocommerce' ); ?>
<?php endif; ?>
</p>
<?php endif; /* else: ?>
<p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), $order ); ?></p>
<ul class="woocommerce-order-overview woocommerce-thankyou-order-details order_details">
<li class="woocommerce-order-overview__order order">
<?php _e( 'Order number:', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="woocommerce-order-overview__date date">
<?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo wc_format_datetime( $order->get_date_created() ); ?></strong>
</li>
<li class="woocommerce-order-overview__total total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->get_payment_method_title() ) : ?>
<li class="woocommerce-order-overview__payment-method method">
<?php _e( 'Payment method:', 'woocommerce' ); ?>
<strong><?php echo wp_kses_post( $order->get_payment_method_title() ); ?></strong>
</li>
<?php endif; */ ?>
</ul>
<?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
<?php do_action( 'woocommerce_thankyou', $order->get_id() ); ?>
<?php else : ?>
<p class="woocommerce-notice woocommerce-notice--success woocommerce-thankyou-order-received"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Thank you. Your order has been received.', 'woocommerce' ), null ); ?></p>
<?php endif; ?>
</div>
I hope that is simply that…
Official Documentation: Template Structure + Overriding Templates via a Theme
Overriding templates in WooCommerce is quite simple, you just have to copy the template file you want to edit into the YOUR_THEME/woocommerce/ directory and edit/add/delete anything you want.
In your case you just have to copy the template file located in wp-content/plugins/woocommerce/templates/checkout/thankyou.php into wp-content/themes/YOUR_THEME/woocommerce/checkout and you're ready to go.
Be aware that you override the template files in child theme, otherwise after updating theme you will lose you changes.
Child theme creation procedure:
create a folder in themes directory and name it yourthemename-child
creat a style.css file and put this comment inside it
/*
Theme Name: Twenty Fifteen Child
Description: Twenty Fifteen Child Theme
Template: parent_theme_name
you can add other attributes here as well
*/

Can't Change Woocommerce "Thank you" message

I've tried to edit the thankyou.php file in woocommerce to include some new text, but it keeps on showing the default message. I am not familiar with what anything means in php, but this is what I've been trying:
<?php
/**
* Thankyou page
*
* #author WooThemes
* #package WooCommerce/Templates
* #version 2.2.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( $order ) : ?>
<?php if ( $order->has_status( 'failed' ) ) : ?>
<p><?php _e( 'Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction.', 'woocommerce' ); ?></p>
<p><?php
if ( is_user_logged_in() )
_e( 'Please attempt your purchase again or go to your account page.', 'woocommerce' );
else
_e( 'Please attempt your purchase again.', 'woocommerce' );
?></p>
<p>
<?php _e( 'Pay', 'woocommerce' ) ?>
<?php if ( is_user_logged_in() ) : ?>
<?php _e( 'My Account', 'woocommerce' ); ?>
<?php endif; ?>
</p>
<?php else : ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Your shirt order has been received and will be at your doorstep in approximately 4 weeks. Thanks again for your support (and general badassery)!', 'woocommerce' ), $order ); ?></p>
<ul class="order_details">
<li class="order">
<?php _e( 'Order:', 'woocommerce' ); ?>
<strong><?php echo $order->get_order_number(); ?></strong>
</li>
<li class="date">
<?php _e( 'Date:', 'woocommerce' ); ?>
<strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
</li>
<li class="total">
<?php _e( 'Total:', 'woocommerce' ); ?>
<strong><?php echo $order->get_formatted_order_total(); ?></strong>
</li>
<?php if ( $order->payment_method_title ) : ?>
<li class="method">
<?php _e( 'Payment method:', 'woocommerce' ); ?>
<strong><?php echo $order->payment_method_title; ?></strong>
</li>
<?php endif; ?>
</ul>
<div class="clear"></div>
<?php endif; ?>
<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php do_action( 'woocommerce_thankyou', $order->id ); ?>
<p><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', __( 'Your shirt order has been received and will be at your doorstep in approximately 4 weeks. Thanks again for your support (and general badassery)!', 'woocommerce' ), null ); ?></p>
The best way to do this would be to filter the WC thank you message:
add_filter( 'woocommerce_thankyou_order_received_text', 'd4tw_custom_ty_msg' );
function d4tw_custom_ty_msg ( $thank_you_msg ) {
$thank_you_msg = 'This is your new thank you message';
return $thank_you_msg;
}
Perhaps your theme is overriding your thank you template file. As a general rule you should never edit the plugin directly. Instead move the thankyou.php to your theme. Move this file to wp-content/themes/yourtheme/woocommerce/checkout/thankyou.php. More information it the documentation here.

Categories