在编辑订单页面WooCommerce上显示ACF字段值

时间:2019-03-21 13:00:50

标签: php wordpress woocommerce advanced-custom-fields orders

我在产品中添加了一些带有ACF的自定义字段。 现在,我要在下订单后在编辑订单页面上的每个已订购商品上显示此字段。 因此,现在在WooCommerce编辑订单页面上会显示购买的每个产品(产品标题)。在每个项目中,我也想显示自定义字段。有人知道这个功能吗?

找到了类似的东西,但这是整个订单而不是每个订购商品的

add_action ('woocommerce_order_details_after_order_table', 'optigem_sendungsnummer', 20);


    function optigem_sendungsnummer( $order ) {

    if (get_field('sendungsnummer', $order->id)) { // Only show if field is filled

?>
        <p class="sendungsnummer">DHL: <?php the_field('sendungsnummer', $order->id);    ?><p>          
        <?php 

    }

}

编辑:在这里找到解决方案;) Output a product custom field in WooCommerce Order Admin Page (ACF)

0 个答案:

没有答案