我需要以某种方式检查某人的角色只有他们的身份.我找到了current_user_can()
支票.但这仅适用于已登录的用户.如果该用户不是当前用户,我该如何检查?我正在使用电话订购系统,但使用管理员/特定帐户为其他人订购.
谢谢
在WooCommerce中,任何与BACS(直接银行转帐)相关的订单都设置为"on-hold"
.
如何自动将其更改为处理?
我不想在里面工作 functions.php
我有以下代码,但这不起作用:
add_filter( 'woocommerce_payment_complete_order_status', 'rfvc_update_order_status', 10, 2 );
function rfvc_update_order_status( $order_status, $order_id ) {
$order = new WC_Order( $order_id );
if ( 'on-hold' == $order_status && 'on-hold' == $order->status ) {
return 'processing';
}
return $order_status;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很棒!
我想做的是制作一个foreach循环来获取所有产品,并从那些我希望获得其类别ID的产品中获取.这样我以后可以检查某些类别.
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_catagory_id .= $item['catagory_id']; //in between these brackets I need a value that gives me the catagory id.
}
//Some validation here if one of the catagorie_id's was found.
//I can build this. It's not part of the question
Run Code Online (Sandbox Code Playgroud)
经过一番评论,这就是我被困的地方:
$order = new WC_Order( $order_id );
$items = $order->get_items();
foreach ( $items as $item ) {
$product_id = $item['product_id'];
var_dump($product_id);
$terms = get_the_term_list( $product_id, …
Run Code Online (Sandbox Code Playgroud)