Answer the question
In order to leave comments, you need to log in
How to store the value as a variable for another page?
Hello, upon successful payment in Woocommerce, I should be redirected to another page, I did it like this in the thankyou.php template
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if($_GET['key'])
{
//echo $order->get_order_number();
set_query_var('numberorder', $order->get_order_number());
//exit;
wp_redirect(home_url('thankyou'));
exit;
}
?>
<span class="order-number"><?php echo $numberorder; ?></span>
Answer the question
In order to leave comments, you need to log in
This is how I tried
`if($_GET['key'])
{
//echo $order->get_order_number();
//set_query_var('numberorder', $order->get_order_number());
//exit;
$_SESSION['numberorder'] = $order->get_order_number();
wp_redirect(home_url('thankyou'));
exit;
}
?>`
`
echo $_SESSION['numberorder'];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question