All users are ordered in a private office, not just one.
-
I have a section of the order that's divided into categories, and in one category, I have a timer and when it ends, orders come from this category. I'm out of shortcode. Because I'm out of the code, there's a variable in this code piece.
$customer_orders
andorders
have NULL. I solved this problem by using this function.$customer_orders->orders = wc_get_orders($args);
♪ Everything's working, it's out of order, but the problem is, it's making out all users' orders. Let's say I didn't buy anything, and another man bought it, and what he bought would show me and him and everyone else. How do I make it look like I bought it? What am I doing wrong? There's got to be something else to transmit to the variable, but I don't know. Here's a piece of the code I use:add_filter( 'woocommerce_account_orders_columns', 'change_account_order_sorting' );
$customer_orders->orders = wc_get_orders($args);
foreach ( $customer_orders->orders as $customer_order ) { $order = wc_get_order( $customer_order ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited $item_count = $order->get_item_count() - $order->get_item_count_refunded(); </code></pre></div></div></p>
-
It's a thrash... - wc_get_orders($args) used to get a specific order, and you don't know what you're doing. We need to ask for a particular user's orders, I mean, if you're authorised... if you don't, by date.
$customer = wp_get_current_user(); if ($customer){ $customer_orders = get_posts( array( 'numberposts' => -1, 'meta_key' => '_customer_user', 'meta_value' => get_current_user_id(), 'post_type' => wc_get_order_types(), 'post_status' => array_keys( wc_get_order_statuses() ), )); }
Here's the receipt of the user's orders, and what you have, don't understand.