Template redirect hook and callback functions must be used with redirect URLs. Here are some simple steps to follow: The first step is to check whether the user is on the checkout page, order page or order acceptance page before creating a custom redirection page. You will use the template_redirect() function. Then add the template_redirect action hook, as shown below: add_action(‘template_redirect’, ‘your_callback_function’); The next step is to create the callback function referenced in the above template redirection hook. However, the name and hook of the callback function must match. To add a page that you want the user to redirect after a successful checkout, you must use the wp_redirect() function in the callback function. It is recommended to add exit after wp_redirect function. This helps prevent redirection problems. To insert code, click shape Menu > theme editor menu. After the theme editor page opens, navigate to the theme feature file where you want to add features. Save changes or theme features. PHP file or plug-in update. That’s all you have to understand. Now, after completing the purchase, the user successfully redirects to the required page.
2. Use the filter to customize the woocommerce audit page. You can customize the existing page instead of creating a custom audit page. In order to achieve this, we will carry out filter and action hook. Action hooking allows you to insert custom code in different locations. Instead, the filter hook allows you to manipulate and return the passed variables. This section uses filters to change the title, personalize the title, and change the text before the order information. We will also show how to create a survey form to collect additional information from customers. It also shows how to send and process Ajax requests for forms.
a) Change the audit page title woocommerce to include \/ WC conditional functions. Provide the is_order_receive_page() function in the PHP file. Use this function to change the page title. The steps to follow include: Log in to the WordPress site and access the dashboard as an administrator. In the panel menu, click shape Menu > theme editor menu. If the topic editor page opens, browse the topic feature file to add the ability to change the title of the audit page. Add the following code to the PHP file: add_filter( ‘woocommerce_endpoint_order-received_title’, ‘njengah_thank_you_title’ );
function njengah_thank_you_title( $old_title ){
return ‘You\’re awesome!’;
}
The results are as follows: Male b) personalized \
To achieve this, you must follow the following steps: Log in to the WordPress site and access the dashboard as an administrator. In the panel menu, click shape Menu > theme editor menu. If the topic editor page opens, browse the topic feature file to add features for personalizing the audit page title. Add the following code to the PHP file: add_filter( ‘woocommerce_endpoint_order-received_title’, ‘njengah_personalize_order_received_title’, 10, 2 );
function njengah_personalize_order_received_title( $title, $id ) {
if (
is_order_received_page() & amp;& amp; amp; get_the_ID() === $id ) {
global $wp;
\/\/ Get the order. Line 9 to 17 are present in order_received() in includes\/shortcodes\/class-wc-shortcode-checkout. php file
$order_id& nbsp; = apply_filters( ‘woocommerce_thankyou_order_id’, absint( $wp->query_vars[‘order-received’] ) );
$order_key = apply_filters( ‘woocommerce_thankyou_order_key’, empty( $_GET[‘key’] ) ? ” : wc_clean( $_GET[‘key’] ) );
if ( $order_id > 0 ) {
$order = wc_get_order( $order_id );
if ( $order->get_order_key() != $ order_key ) {
$order = false;
}
}
if ( isset ( $order ) ) {
\/\/$title = sprintf( \
$title = sprintf( \
}
}
return $title;
}
The results are as follows: Male C) the text before the order information is changed. By default, the text before the order information is: \
Male woocomerce has a filter that can change the following text: woocommerce_thankyou_order_received_text. To make changes, the following steps must be followed: Log in to the WordPress site and access the dashboard as an administrator. In the panel menu, click shape Menu > theme editor menu. If the topic editor page opens, browse the topic feature file to add features for personalizing the audit page title. Add the following code to the PHP file: add_filter(‘woocommerce_thankyou_order_received_text’, ‘njengah_change_order_received_text’, 10, 2 );
function njengah_change_order_received_text( $str, $order ) {
$new_str = $str . ‘ We have emailed the purchase receipt to you.’;
return $new_str;
}
Remember, you can add your own text here. The results are as follows: Or if you want the customer to the form, you can add instructions. You can provide custom links from which to products. To do so is functions Add the following code to the PHP file: add_filter(‘woocommerce_thankyou_order_received_text’, ‘njengah_change_order_received_text’, 10, 2 );
function njengah_change_order_received_text( $str, $order ) {
$new_str = ‘We have emailed the purchase receipt to you. Please make sure to fill & lt; a href=\
. also shares the method of overriding the template to add additional elements to the audit page. To improve retention, you must be very creative when editing this page. But the function. Always be careful when editing PHP files. If an error occurs, an error is displayed. You can also customize the audit page using the page builder plug-in. Relevance must be maintained, including videos of shopkeepers recommending products. This will lead customers to participate and encourage them to buy more products in the store. I hope this tutorial will help solve the problem. Woocommerce redirect after checkout of similar articles: redirect more than 100 Tips on customized audit page, How to add trick and silent ultimate woocommerce hide guide product image woocommerce payment page woocommerce image placeholder guide woocommerce how to hide product weight store theme woocommerce how to hide labels change coupon code placeholder woocommerce store first screen sorting options, Method of changing and adding Name: method of hiding product SKU in woocomer method of hiding category in shopping page woocomer method of hiding price when it is 0 in woocomer method of hiding next line 0 method woocomer address label hiding and renaming method of hiding my account page woocomer method of number of products woocomer use How to add a custom payment message woocommerce how to export products woocommerce how to set the maximum or minimum order quantity SKU, category How to hide the tag meta product page? Select all but the last sub item in woocommerce CSS? Custom CSS is not the pre-sale settlement page of the last sub item