Thread Starter
nixgod
(@nixgod)
I don’t particularly like doing the work for you, frankly i see most of the plugins in existence today as some kinda predatory bait and switch scheme.. Purposely limiting features that they know most people need.. look its fine to monetize, but only for features that really need to be paid, pay-walling core functionality of some plugins these days is the norm and frankly i look at all plugins the same due to the overwhelming majority of bad eggs..
With my required rant out of the way, i think this is because you’re either not hooking the right method in WooCommerce or it has something to do with them switching to their internal Analytics system and not the old style reports, through some tinkering i got it to count the orders in Analytics, which for some reason required me to enable the Analytics because they were disabled in options.php idk why..
But, it also could be a hook issue too, because i had already switched or begun switching to another add-on for the same thing and it could be calling a method that make your add-on work too i can’t know for sure.. i don’t know the codebase
@nixgod You can add this code to your functions file to include all custom statuses in the report list. this way, all statuses marked as “paid” will be included in the reports. If you want to include all custom statuses, simply remove the meta_query
.
I hope this code help other with same issue
add_filter( 'woocommerce_reports_order_statuses', 'register_status_on_reports', 20, 1 );
function register_status_on_reports( $statuses ) {
if( !$statuses ){ $statuses = []; } // avoid php 8
$arg = array(
'numberposts' => -1,
'post_type' => 'order_status',
'meta_query' => [[
'key' => 'is_status_paid',
'compare' => '=',
'value' => '1',
]],
);
$postStatusList = get_posts( $arg );
foreach ( $postStatusList as $post ) {
$slug = get_post_meta( $post->ID, 'status_slug', true );
$statuses[] = $slug;
}
return $statuses;
}
Hello,
We are delighted to assist you.
Here’s how you can view the status of custom orders from the Analytics option:
1- Go to Analytics > Settings > Excluded Statuses: Here, you can exclude or include the existing WooCommerce statuses or custom statuses that you choose.
2- Go to Analytics > Orders: In this section, you can see the selected order statuses (both existing and custom).
Additionally, you can use the “Show” option to select the advanced filter and view the specific status you want separately.
Meanwhile, our team will be evaluating why this is not functioning as expected in the reports.
Peace!
Likewise, thank you luizdevplugins for your comment and contribution to the community. We will be testing and analyzing the code.
Hello,
Since we haven’t received a recent response, I will mark this as resolved.
Please feel free to open a new ticket if you need further assistance or to reopen this ticket.
We will be happy to help you. Thank you.
– Peace !