我正在尝试获取 thankyou.php 页面上的交易 ID,但 WC_Order 对象没有 Paypal 交易 ID。
WC_Order 对象:-
WC_Order Object
(
[order_type] => simple
[id] => 49
[post] => WP_Post Object
(
[ID] => 49
[post_author] => 1
[post_date] => 2016-01-08 13:55:24
[post_date_gmt] => 2016-01-08 13:55:24
[post_content] =>
[post_title] => Order – January 8, 2016 @ 01:55 PM
[post_excerpt] =>
[post_status] => wc-pending
[comment_status] => open
[ping_status] => closed
[post_password] => order_568fbfcc2b0f2
[post_name] => order-jan-08-2016-0155-pm
[to_ping] =>
[pinged] =>
[post_modified] => 2016-01-08 13:55:24
[post_modified_gmt] => 2016-01-08 13:55:24
[post_content_filtered] =>
[post_parent] => 0
[guid] => http://localhost/lfdemo/?post_type=shop_order&p=49
[menu_order] => 0
[post_type] => shop_order
[post_mime_type] =>
[comment_count] => 0
[filter] => raw
)
[order_date] => 2016-01-08 13:55:24
[modified_date] => 2016-01-08 13:55:24
[customer_message] =>
[customer_note] =>
[post_status] => wc-pending
[prices_include_tax] =>
[tax_display_cart] => excl
[display_totals_ex_tax] => 1
[display_cart_ex_tax] => 1
[formatted_billing_address:protected] =>
[formatted_shipping_address:protected] =>
)
我需要一些帮助!所以请发表评论并提供解决方案!
最佳答案
交易 ID 是帖子元数据的一部分...
$transaction_id = get_post_meta($order_id, '_transaction_id', true);
关于php - 如何在 WooCommerce 中获取 Paypal 交易 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34679711/