liquidweb / woocommerce-custom-orders-table

Store WooCommerce order data in a custom table for improved performance.
GNU General Public License v3.0
476 stars 51 forks source link

Use discretion between order types (orders and refunds) #147

Closed mfs-mindsize closed 2 years ago

mfs-mindsize commented 5 years ago

Describe the bug Currently, get_postmeta_mapping() returns an array of fields/rows/columns to be migrated. That same array is used to delete post meta. The issue is, it's possible to use custom meta keys for refunds that (in theory) could also be in that list. Those meta rows for refunds would be migrated even though they are not part of core functionality. Worse, those meta rows will be deleted (and undermine the custom functionality using those custom meta keys).

Also, while minor, looping over the whole get_postmeta_mapping() for refunds also means unnecessary attempts to add and delete.

To Reproduce n/a

Expected behavior get_postmeta_mapping() should return an array that is targeted to the order type being processed.

stevegrunwell commented 4 years ago

Excellent points and definitely something to be addressed, thank you!!