🚀 Is building a website too difficult? Let me guide you step by step—Learn about the 「Naibabiji WordPress Website Building Coaching Service」 →

Method to Add a Payment Success Notification Page for WooCommerce

Foreign Trade Website BuildingMany companies use WooCommerce as their e-commerce system to sell their products. Today, I'll share a method for remarketing after a customer completes payment, such as displaying related products, guiding shares and follows, or creating a beautiful thank-you page. We can use the WooCommerce after-payment redirect function.The specific operation method is as follows:1. Create a new page to redirect to. 2. Copy the code below and paste it into the theme's functions file.
/**
* WooCommerce付款后重定向页面
* @link https://blog.naibabiji.com/
*/

add_action( 'woocommerce_thankyou', 'naibabiji_woocommerce_payment_redirect');
function naibabiji_woocommerce_payment_redirect( $order_id ){
$order = wc_get_order( $order_id );
$url = 'https://blog.naibabiji.com/';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
3. Modify the URL after `$url =` in the code above to the URL of the redirect page. Save and test if it works.Finally, if you think this code is too simple and cannot meet your personalized redirect needs, you can use the following paid plugin to handle it.YITH WooCommerce Custom Thank You PageThis plugin helps you customize the „Thank You“ page displayed to customers after order completion and use it to promote upsell products.
  1. You can customize the „Thank You“ page for the entire store or for individual products.
  2. You can leverage the „Thank You“ page to promote products related to the one just purchased, thereby increasing sales.
  3. By having customers share their purchases on social networks, you can gain indirect advertising for your store and products.

🚀 Still feeling confused after reading the tutorial? Let me guide you step-by-step.

「Naibabiji WordPress Website Building Coaching Service」—From choosing a domain and buying hosting, to installing a Theme and publishing content, I「ll coach you through every step, helping you avoid detours and reach your goal directly.

👉 Learn about the Website Building Coaching Service
🔒

Comments are closed

The comment function for this article is closed. If you have any questions, please feel free to contact us through other channels.

×
二维码

Scan QR Code to Follow

AI Website Building Assistant

🤖
Hello! I am the Naibabiji AI Assistant. How can I help you?
Quick Consultation: