Ecommerce Shopify WordPress Discussion

Woocommerce – redirect user to custom thank you page after an order is placed

I need a bit of help with woocommerce customization. I need to redirect the user after the order is completed to a custom page, I'm using this code in my plugin but seems not working public function redirect_customer_after_order() { if( is_checkout() && isset( $wp->query_vars['order-received'] ) ){ wp_safe_redirect( site_url( 'riepilogo-ordine' ) ); exit; } } add_action( 'template_redirect', array( $this, 'redirect_customer_after_order' ) ); I've tried to place an order but my custom woocommerce elementor page will be not displayed and I will see the default woocommerce thank you page. Also I've noticed that this hook will be ignored remove_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button' ); It will simple remove the order again button, I've placed it inside the __construct() of my plugin. How I can fix these two issues?
Correct Hook: Use woocommerce_thankyou instead of template_redirect for more reliable redirection within WooCommerce public function redirect_customer_after_order( $order_id ) { wp_safe_redirect( site_url( 'riepilogo-ordine' ) ); exit; } add_action( 'woocommerce_thankyou', array( $this, 'redirect_customer_after_order' ) ); Run code snippetExpand snippet Correct Hook Priority: Use a higher priority to ensure your code runs after WooCommerce's remove_action( 'woocommerce_order_details_after_order_table', 'woocommerce_order_again_button', 10 ); Run code snippetExpand snippet

December 29, 2023

TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.