在 WooCommerce 我的帐户自定义选项卡中显示订单产品自定义 acf 字段值

Show order products custom acf field value in WooCommerce my account custom tab

提问人:Usman 提问时间:11/17/2023 最后编辑:LoicTheAztecUsman 更新时间:11/18/2023 访问量:19

问:

我正在尝试在我的 WooCommerce 帐户页面中显示一个新选项卡,我已经成功添加了该选项卡。

现在我想在该选项卡中显示产品自定义字段值,实际上我已经创建了产品手册字段,我将从每个产品的后端更新该字段。

因此,我只想向实际订购该产品的客户展示这些价值。

add_action( 'woocommerce_account_premium-support_endpoint', 'bbloomer_premium_support_content' );
function bbloomer_premium_support_content($order_id ) {
    echo '<h3>Product Updates</h3>
    <p>Welcome to the WooCommerce support area. As a premium customer, you can submit a ticket should you have any WooCommerce issues with your website, snippets or customization. <i>Please contact your theme/plugin developer for theme/plugin-related support.</i></p>';
  
    $order = wc_get_order($order_id);

    foreach( $order->get_items() as $item ) {
          echo the_field('pdf_manual', $item->id);
    }
}
php wordpress woocommerce 高级自定义字段

评论


答: 暂无答案