嗨,我在结帐页面的woocommerce自定义计费字段中遇到了麻烦,我想从某个字段的get_meta_data()获取价值,在我的脚本中是:
$item_meta_data = $orderID->get_meta_data();
和变量$ item_meta_data具有这样的数组:
Array ( [0] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67469 [key] => _billing_dropship_name [value] => KINARA STOREZ ) [data:protected] => Array ( [id] => 67469 [key] => _billing_dropship_name [value] => KINARA STOREZ ) ) [1] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67470 [key] => _billing_dropship_telp [value] => 081212083563 ) [data:protected] => Array ( [id] => 67470 [key] => _billing_dropship_telp [value] => 081212083563 ) ) [2] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67471 [key] => billing_dropship_name [value] => KINARA STOREZ ) [data:protected] => Array ( [id] => 67471 [key] => billing_dropship_name [value] => KINARA STOREZ ) ) [3] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67472 [key] => billing_dropship_telp [value] => 081212083563 ) [data:protected] => Array ( [id] => 67472 [key] => billing_dropship_telp [value] => 081212083563 ) ) [4] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67476 [key] => _order_stock_reduced [value] => yes ) [data:protected] => Array ( [id] => 67476 [key] => _order_stock_reduced [value] => yes ) ) [5] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 67847 [key] => wf_invoice_number [value] => 7486 ) [data:protected] => Array ( [id] => 67847 [key] => wf_invoice_number [value] => 7486 ) ) [6] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 68951 [key] => _wcpdf_invoice_settings [value] => Array ( [enabled] => 1 [display_shipping_address] => 1 [display_phone] => 1 [display_date] => invoice_date [display_number] => invoice_number [number_format] => Array ( [prefix] => [suffix] => [padding] => ) [my_account_buttons] => available [paper_size] => a4 [font_subsetting] => 1 [header_logo] => [shop_name] => Array ( [default] => Pengirim ) [shop_address] => Array ( [default] => [biiling_dropship_name] [biiling_dropship_no_telp] ) [footer] => Array ( [default] =>
) [extra_1] => Array ( [default] => ) [extra_2] => Array ( [default] => ) [extra_3] => Array ( [default] => ) ) ) [data:protected] => Array ( [id] => 68951 [key] => _wcpdf_invoice_settings [value] => Array ( [enabled] => 1 [display_shipping_address] => 1 [display_phone] => 1 [display_date] => invoice_date [display_number] => invoice_number [number_format] => Array ( [prefix] => [suffix] => [padding] => ) [my_account_buttons] => available [paper_size] => a4 [font_subsetting] => 1 [header_logo] => [shop_name] => Array ( [default] => Pengirim ) [shop_address] => Array ( [default] => [biiling_dropship_name] [biiling_dropship_no_telp] ) [footer] => Array ( [default] =>
) [extra_1] => Array ( [default] => ) [extra_2] => Array ( [default] => ) [extra_3] => Array ( [default] => ) ) ) ) [7] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 68952 [key] => _wcpdf_invoice_date [value] => 1541402193 ) [data:protected] => Array ( [id] => 68952 [key] => _wcpdf_invoice_date [value] => 1541402193 ) ) [8] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 68953 [key] => _wcpdf_invoice_date_formatted [value] => 2018-11-05 07:16:33 ) [data:protected] => Array ( [id] => 68953 [key] => _wcpdf_invoice_date_formatted [value] => 2018-11-05 07:16:33 ) ) [9] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 68954 [key] => _wcpdf_invoice_number [value] => 10 ) [data:protected] => Array ( [id] => 68954 [key] => _wcpdf_invoice_number [value] => 10 ) ) [10] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 68955 [key] => _wcpdf_invoice_number_data [value] => Array ( [number] => 10 [formatted_number] => 10 [prefix] => [suffix] => [document_type] => invoice [order_id] => 7486 [padding] => ) ) [data:protected] => Array ( [id] => 68955 [key] => _wcpdf_invoice_number_data [value] => Array ( [number] => 10 [formatted_number] => 10 [prefix] => [suffix] => [document_type] => invoice [order_id] => 7486 [padding] => ) ) ) [11] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 74941 [key] => _download_permissions_granted [value] => yes ) [data:protected] => Array ( [id] => 74941 [key] => _download_permissions_granted [value] => yes ) ) [12] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 75958 [key] => _wcpdf_packing_slip_date [value] => 1541414612 ) [data:protected] => Array ( [id] => 75958 [key] => _wcpdf_packing_slip_date [value] => 1541414612 ) ) [13] => WC_Meta_Data Object ( [current_data:protected] => Array ( [id] => 75959 [key] => _wcpdf_packing_slip_date_formatted [value] => 2018-11-05 10:43:32 ) [data:protected] => Array ( [id] => 75959 [key] => _wcpdf_packing_slip_date_formatted [value] => 2018-11-05 10:43:32 ) ) )
我想从biiling_dropship_name和biiling_dropship_no_telp获取价值,我该怎么做?我已经尝试使用$ item_meta_data-> biiling_dropship_name了,但是没有用,我想有人可以帮助我,谢谢。