[英]Getting cookie value on thankyou page WooCommerce
Using woocommerce_thankyou hook to send and receive data from api during order submission.在订单提交期间使用 woocommerce_thankyou 钩子从 api 发送和接收数据。 In one of my requests, i get an order number from in-house software.. example: 321000
在我的一个请求中,我从内部软件中获得了一个订单号。例如:321000
$_SESSION['quotes'] = $quoteId;
echo session_id() . '</br>';
echo $_SESSION['quotes'] . '</br>';
which outputs:输出:
0ajcojut4fu9cac4ji96gj9j03
321000
I need to get this number on the thank you page.我需要在感谢页面上得到这个号码。 I have tried both sessions and cookies.
我已经尝试了会话和 cookie。 I am able to save this value both ways, but it outputs previous variable on thank you page.
我能够以两种方式保存此值,但它会在感谢页面上输出先前的变量。
When I echo on thankyou page, previous value is used.. example 320999当我在谢谢页面上回声时,使用以前的值.. 示例 320999
Is there a way to set and echo session variable/cookie before thank you page is shown?有没有办法在显示感谢页面之前设置和回显会话变量/cookie?
Is there another hook I should be using instead of woocommerce_thankyou我应该使用另一个钩子而不是 woocommerce_thankyou
我使用了 woocommerce_checkout_order_processed 钩子而不是 woocommerce_thankyou 并且一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.