Reputation: 439
I am actually integrating a woo-commerce website with an Accounting software Quickbooks where the integrated system(vb.net) will import all the paid and unpaid orders with corresponding paid amounts therefore need to know where certain information such a payment amount and method is saved
I searched in all the WooCommerce database tables looking for payment information such as (Payment amount, payment method) associated with the order but couldn't find Even in the below table couldn't find anything related to payment
Table: woocommerce_payment_tokens
Table: woocommerce_payment_tokenmeta
https://github.com/woocommerce/woocommerce/wiki/Database-Description
Can someone please guide where is the payment amount and method saved. Thanks in advance
Upvotes: 3
Views: 4418
Reputation: 3126
WooCommerce orders are a custom WordPress post type. All order information can be retrieved from the order object (Order post meta). WooCommerce provides getter functions to retrieve this data. For instance the order total and payment method:
$total = $order->get_total();
$payment_method = $order->get_payment_method();
More information on the structure here: https://github.com/woocommerce/woocommerce/wiki/Order-and-Order-Line-Item-Data
If you are set on retrieving data from the database you can search the wp_posts
table (since orders are a custom post type). You will have to search the post_type
field for shop_order
.
Then, you will have to search the wp_postmeta
table for all the records with a post_id
that matches the id of the order post.
Upvotes: 2