mercredi 8 juin 2016

How are partial refunds stored in the WooCommerce Database?

I have a simple backend management tool written in PHP that pulls orders from the WooCommerce database and presents them to our kitchen for processing deliveries.

I have always been able to highlight a table row that had a status other than 'wc-completed' to handle any additional processing that might be needed. However, it was brought to my attention today that one particular order had been refunded for one line item. A partial refund does not change the order status, so I need to pull the refund info from another table in the database.

I checked all the tables I know of related to order processing - wp_posts, wp_postmeta, wp_woocommerce_order_items and wp_woocommerce_order_itemmeta, but no sign of any refund information. In fact, the itemmeta contained in the last table doesn't even adjust the quantity, making my reports incorrect for partial orders like this.

When you view the order summary in the woocommerce backend, it shows a quantity of 1 for this particular item, and then a -1 right below it. I assume based on this, that somewhere in the database there are refund records associated with the orders, but I can't seem to find it. Even the order total in wp_postmeta doesn't reflect the partial refund.

Does anyone know where this refund data is stored in the wordpress database?

Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire