Tagged: check out, woocommerce
In the old days WooCommerce shipped with a “thank you” page but these days they use endpoints….. What I would like to do, and I am struggling to find a suitable answer anywhere (Woo Support is about as fast as treacle!!!), is to redirect to a thank you page or endpoint rather than a summary or order-received….
But how?
Hey Adendum!
Try adding this code to theme / child theme functions.php:
add_action( 'woocommerce_thankyou', function( $order_id ){
$order = new WC_Order( $order_id );
$url = 'http://redirect-here.com';
if ( $order->status != 'failed' ) {
echo "<script type="text/javascript">window.location = '".$url."'</script>";
}
});
Reference:
http://stackoverflow.com/questions/25114082/woocommerce-action-hook-to-redirect-to-custom-thank-you-page
Please note that this request is outside our support scope.
Regards,
Josue
Josue,
Yup – found the same in WooCommerce documentation last night. Sorted.