我试图制定一个工作流程,店铺经理可以创建订单并将其标记为“待处理付款”,“处理”但只有管理员可以将订单标记为“完成”,“失败”等。按角色限制woocommerce订单状态
我发现的最接近的是this post:
<?php
if (current_user_can(! 'administrator')) {
$args = array('post_type' => 'post', 'post_status' => 'publish, pending,
draft');
} else {
$args = array('post_type' => 'post', 'post_status' => 'publish');
}
$wp_query = new WP_Query($args); while (have_posts()) : the_post(); ?>
CONTENT
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
这应该定期WP岗位工作(虽然我没有测试过),但我不知道如何应用到Woocommerce。我最好的猜测是:
<?php
if (current_user_can(! 'administrator')) {
$args = array('post_type' => 'shop_order', 'order_status' => 'complete,failed');
} else {
$args = array('post_type' => 'shop_order', 'post_status' => 'pending-payment,processing');
}
$wp_query = new WP_Query($args); while (have_posts()) : the_post(); ?>
CONTENT
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
但我得到各种各样的错误!我也不确定它是否仅适用于修改订单屏幕,而不适用于管理商店订单表批量操作下拉菜单。
任何帮助将非常感谢!
你给进入WP管理仪表板,除了管理员角色?或者您正在创建任何前端页面来列出所有订单和状态更新? – Sourav