admin管理员组文章数量:1129783
Until now, I used this code to display a order custom field value inside a template:
<?php echo esc_html( get_post_meta( $order->get_id(), 'my_custom_field', true ) ); ?>
When enabling HPOS as the only option, this code no longer works.
I tried:
<?php echo esc_html( $order->get_billing_my_custom_field() ); ?>
,
but I keep getting this error: Fatal error: Uncaught Error: Call to undefined method
Automattic\WooCommerce\Admin\Overrides\Order::get...
Until now, I used this code to display a order custom field value inside a template:
<?php echo esc_html( get_post_meta( $order->get_id(), 'my_custom_field', true ) ); ?>
When enabling HPOS as the only option, this code no longer works.
I tried:
<?php echo esc_html( $order->get_billing_my_custom_field() ); ?>
,
but I keep getting this error: Fatal error: Uncaught Error: Call to undefined method
Automattic\WooCommerce\Admin\Overrides\Order::get...
Share Improve this question asked Sep 10, 2023 at 19:18 DanielDaniel 11 Answer
Reset to default 0Use $order->get_meta('my_custom_field')
instead.
本文标签: phpDisplay WooCommerce Order Custom Field In Template (HPOS)
版权声明:本文标题:php - Display WooCommerce Order Custom Field In Template (HPOS) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736754314a1951204.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论