Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何从感谢页面中的订单访问自定义字段_Php_Wordpress_Woocommerce - Fatal编程技术网

Php 如何从感谢页面中的订单访问自定义字段

Php 如何从感谢页面中的订单访问自定义字段,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,我在订单中创建了很多自定义字段,现在我正在尝试在“谢谢”页面上完成订单后访问这些字段 我已经看到了反应,但对我来说不起作用。我做一个var转储来查看$order->order\u custom\u字段的内部内容,但我只得到字符串(0)“ 我正在编辑文件order-details-customer.php如何访问自定义字段 下面是我创建的自定义字段的示例 woocommerce_form_field( 'destination_state', array( 'typ

我在订单中创建了很多自定义字段,现在我正在尝试在“谢谢”页面上完成订单后访问这些字段

我已经看到了反应,但对我来说不起作用。我做一个var转储来查看
$order->order\u custom\u字段的内部内容
,但我只得到
字符串(0)“

我正在编辑文件order-details-customer.php如何访问自定义字段

下面是我创建的自定义字段的示例

        woocommerce_form_field( 'destination_state', array(
        'type'          => 'text',
        'class'         => array('destination_state form-row-first'),
        'label'         => __('State'),
        'required'      => true,
        ), $checkout->get_value( 'destination_state' ));

经过一番探索和逻辑思考,我发现这很容易

echo '<p>' . get_post_meta(  $order->id, 'Date Collection', true ) . '</p>';
echo''。获取发布元($order->id,'datecollection',true)。'

",;