I'm trying to make a workflow where shop managers can create orders and mark them as "pending payment", "processing" but only admins can mark orders as "complete", "failed" etc.
The closest I've found was in 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(); ?>
This should work for regular WP posts (although I haven't tested it) but I'm not sure how to apply to Woocommerce. My best guess is:
<?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(); ?>
But I'm getting all sorts of errors with this! I'm also not sure if it would only apply to the edit order screen and not the admin shop order table bulk actions dropdown.
Any help would be really appreciated!