-1

I have a WooCommerce set up, whereby all orders are added manually.

When I add a (pending) order, the WooCommerce order status hook registers the sale (for reporting).

I wish the switch this process to the hook called only when the order is (again manually) set to 'complete'.

There are a couple plugins ( eg. https://docs.woocommerce.com/document/woocommerce-order-status-control/ / https://wordpress.org/plugins/advanced-reporting-for-woocommerce/ etc ), but these are either overkill or simply don't provide this functionality..

I've also found a couple related posts, essentially describing overriding the woocommerce hooks to this end ( Getting order data after successful checkout hook etc, but unfortunately whilst the solutions correspond ( ie adapting the correct hooks - the context differs ).

I'm reluctant to prevent functionality in these hooks when attempting to overwrite/reorder the actions so any pointers which hooks I can use to achieve this would be really helpful.

Many thanks!

Toki
  • 517
  • 3
  • 9
  • 27

1 Answers1

0

maybe you can try to use the ... filter, something like (untested):

add_filter( 'woocommerce_reports_order_statuses', 'fc_order_status_reports', 20, 1 );
function fc_order_status_reports( $statuses ) {

  $statuses = array('completed');

  return $statuses;

}

The code snippet is to add to your active theme's functions.php file.

Let me know if it does the job ;)

FrancescoCarlucci
  • 1,570
  • 12
  • 13
  • Remarkably that appears ( at first glance ) to have worked perfectly!! Thank's so much @FrancescoCarlucci ! – Toki Feb 01 '19 at 11:53
  • Hi, just wanted ask something on this - as the WooCommerce status 'resets' each month, is it possible with this that an order created one month, then completed the next wouldn't be registered, or would be counted into the previous month? I tested a few times and it works fine, but I completed one order which didn't register and I wonder if that could be why? – Toki Mar 08 '19 at 02:13