我尝试获取 Woocommerce 订单中附加的费用名称,我得到一个数组,但我不知道如何获取该名称。
我尝试使用函数 get_name () 但它不起作用。
$the_order->get_items( array( 'line_item', 'fee', 'shipping' ) );
原始数据输出:
[137] => WC_Order_Item_Fee Object
(
[extra_data:protected] => Array
(
[tax_class] =>
[tax_status] => taxable
[amount] =>
[total] =>
[total_tax] =>
[taxes] => Array
(
[total] => Array
(
)
)
)
[data:protected] => Array
(
[order_id] => 7795
[name] => Frais de réservation
[tax_class] => 0
[tax_status] => taxable
[amount] =>
[total] => 35
[total_tax] => 0
[taxes] => Array
(
[total] => Array
(
)
)
) Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号