• Hello, i need help with a code to count the waiting orders by short code

    code example

    function pruebashort(){
    $current_user = wp_get_current_user();
    $numorders = wc_get_customer_order_count( $current_user->ID );
    
    $args = array(
        'customer_id' => $current_user->ID,
        'post_status' => 'waiting',
        'post_type' => 'shop_order',
        'return' => 'ids',
    );
    $numorders_waiting = 0;
    $numorders_waiting = count( wc_get_orders( $args ) ); // count the array of orders
    
    	return count $numorders_waiting;
    }
    add_shortcode( 'count_can_ord','pruebashort');
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘count waiting vendor orders by shortcode’ is closed to new replies.