WooCommerce付款状态或令牌 - 如何获得_
我是PHP的新手。
我正在尝试检查用户是否有付款令牌或其他一些确认他们已经付款的价值。
如果付款状态为空,我想重定向页面,他们尚未付款)。
我尝试过:
<?php
if(get_post_type()=="sfwd-lessons"){
$lesson_id=get_the_ID();
}else{
$lesson_id=get_post_meta(get_the_ID(),'lesson_id',true);
}
$value = get_field( "new_field", $lesson_id );
$user_status=get_wpmg_woocommerce_payment_tokens($user_id,'token_id',true);
//$user_status='';
if(!empty($value) && empty($user_status)){
header('Location: https://xx/checkouts/checkout-page/');
exit;
?>
但是我认为“ get_wpmg_woocommerce_payment_tokens”是一个有效的调用
,我可以拨打另一个get_呼叫,我可以检查付款token_id是否为该用户为空?
还是在Woo Commerce上有办法谢谢您的页面,以编写新的字段“ pealdy_status”完整为user_meta_data
谢谢
I am newbie at PHP.
I am trying to check if the user has a payment token or some other value that confirms they have made a payment.
I want to redirect the page if the payment status is empty 9they have not made payment yet).
I tried :
<?php
if(get_post_type()=="sfwd-lessons"){
$lesson_id=get_the_ID();
}else{
$lesson_id=get_post_meta(get_the_ID(),'lesson_id',true);
}
$value = get_field( "new_field", $lesson_id );
$user_status=get_wpmg_woocommerce_payment_tokens($user_id,'token_id',true);
//$user_status='';
if(!empty($value) && empty($user_status)){
header('Location: https://xx/checkouts/checkout-page/');
exit;
?>
but I dot think "get_wpmg_woocommerce_payment_tokens" is a valid call
is there another get_ call I can make to check if payment token_id is empty for that user?
or is there a way on the woo commerce thank you page to write new field "payment_status" complete to user_meta_data
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此挂钩
woocommerce_thankyou
每次刷新Thankyou页面时都会发射。完成订单付款后,将一些数据发送到第三方的最佳挂钩是
woocommerce_payment_complete
。This hook
woocommerce_thankyou
will fire each time you refresh the thankyou page.The best hook for sending some data to a third party when order payment is completed is
woocommerce_payment_complete
.HI @aidan545已经解决了您可以从链接中的以下链接中检查它,它将为您提供一种适当的方法,可以使用woocommerce对象wc_order链接访问所有订单详细信息
:如何获取WooCommerce订单详细信息
Hi @aidan545 it's already resolved you can check from the below link in the link it will give you a proper way for accessing all the order details with woocommerce object WC_Order
Link: How to get WooCommerce order details