如何获得在functions.php中的功能中使用的woocommerce订单的订单ID?
我希望能够在以下时间检查订单的ID:
woocommerce我的帐户页面(针对每个订单):http://example.com/my-account
和
woocommerce结帐页面(针对当前订单):http://example.com/checkout/order-pay/210?pay_for_order=true&key=order_53df9a0e8116a
我知道在结帐页面上, 可以通过$ order-> id访问订单ID;在form-pay.php模板(位于plugins / woocommerce / templates / checkout / form-pay.php中)中, 我希望能够从主题的functions.php文件中执行相同的操作。
#1
答案是:
get_query_var(‘order-pay’);
我通过查看var_dump($ GLOBALS)找到了这个-感谢this.lau_的建议
来源:
https://www.srcmini02.com/66507.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_37079.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57