How to redirect customers to a custom landing page after the order process?
Some of them need specific page redirection after the order process to achieve more sales.
Below code will help you to find solution.
PHP Code
/**
* @snippet Redirect to custom page after complete order – WooCommerce
*/
add_action( 'woocommerce_thankyou', 'mycode_redirect');
function mycode_redirect( $order_id ){
$order = wc_get_order( $order_id );
$url = 'https://codeamend.com/thank-you';
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
Popular Posts
- Show / Hide div based on dropdown selected using jQuery
- Autosuggestion Select Box using HTML5 Datalist, PHP and MySQL with Example
- Custom Authentication Login And Registration Using Laravel 8
- Infinite Scrolling on PHP website using jQuery and Ajax with example
- Google Login or Sign In with Angular Application
- How to Convert MySQL Data to JSON using PHP
- How to change date format in PHP?
- Image Lazy loading Using Slick Slider
- Slick Slider Basic With Example
- php in_array check for multiple values
- Adaptive Height In Slick Slider
- Slick Slider Center Mode With Example
Total Views: 1,826