Custom Thank you page
Setting redirect to new custom page
// Check if WooCommerce is active before adding the action hook
if (class_exists('WooCommerce')) {
/**
* Custom Thank You Page Redirect
*/
add_action('template_redirect', 'bt_custom_redirect_to_custom_thank_you');
function bt_custom_redirect_to_custom_thank_you() {
// Check if we are on the WooCommerce order received (thank you) page
if (!is_wc_endpoint_url('order-received') || empty($_GET['key'])) {
return; // Exit if not on the default "Thank You" page
}
// Get the order ID from the order key in the URL
$order_id = wc_get_order_id_by_order_key($_GET['key']);
if (!$order_id) {
return; // Exit if order ID is not found
}
// Construct the URL of your custom "Thank You" page and append the order ID as a query parameter
$custom_thankyou_page_url = add_query_arg(
array(
'order_id' => $order_id,
'order_key' => $_GET['key'],
),
site_url('thank-you') // Ensure the URL matches your custom page slug
);
// Perform the redirect to the custom "Thank You" page
wp_safe_redirect($custom_thankyou_page_url);
exit;
}
}Designing with Bricks
Product table:
Order summary
Order billing and shipping details:
Failed orders

Last updated