Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Refunded orders not getting migrated to custom table #45

Closed
zacscott opened this issue Feb 14, 2018 · 1 comment · Fixed by #52
Closed

Refunded orders not getting migrated to custom table #45

zacscott opened this issue Feb 14, 2018 · 1 comment · Fixed by #52

Comments

@zacscott
Copy link

There is an issue with the migration of refunded orders to the custom table. I am running the wp wc-order-table migrate command and it is silently skipping the refunded orders, while other orders are updated just fine.

I have done a little debugging and it appears the call to populate_from_meta() on the data store is failing, in WooCommerce_Custom_Orders_Table_CLI::migrate().

This line specifically - $result = $order->get_data_store()->populate_from_meta( $order );

That call is returning NULL which is fails the error check on the line below, so there is no error reporting at all when this happens.

@stevegrunwell stevegrunwell self-assigned this Feb 14, 2018
@stevegrunwell stevegrunwell added this to the Version 1.0.0 milestone Feb 14, 2018
@stevegrunwell
Copy link
Contributor

@zacscott congrats, you've stumbled upon a much larger issue with the plugin!

As it turns out, WooCommerce uses a separate data store for refunds than orders (though they're closely related), so the CLI command was looking for all posts with types matching wc_get_order_types( 'reports' ) (e.g. ("shop_order" or "shop_order_refund") but only actually handling the former.

I'm working on a patch right now that will introduce the necessary data store to let refunds leverage the custom orders table as well. Thank you for catching this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants