久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在客戶訂單歷史記錄中顯示最后的 WooCommerce 管理

Display last WooCommerce admin order note in customers order history(在客戶訂單歷史記錄中顯示最后的 WooCommerce 管理員訂單備注)
本文介紹了在客戶訂單歷史記錄中顯示最后的 WooCommerce 管理員訂單備注的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

我希望在客戶的訂單歷史記錄中顯示最后一個訂單說明,目前只能通過 Woocommerce 中的管理員查看.

I am looking to display the last Order Note, currently only viewable via Admin in Woocommerce, on the customer side in their Order History.

這樣他們就可以查看我們在之后添加的跟蹤編號,訂單被設置為完成.

So they can view the tracking number we add in after the order is set as complete.

https://example.com/my-account/view-order/135/

我們首先通過 Woocommerce API 將訂單設置為 COMPLETE,然后添加帶有跟蹤鏈接的訂單備注,從而添加客戶備注.因此,跟蹤引用將始終是最后一項.

We add a customer note by first setting the order as COMPLETE via the Woocommerce API then adding an order note with the tracking link. So the tracking ref will always be the last item.

如何在客戶訂單歷史記錄中顯示最后一個訂單備注?似乎不存在用于在客戶端顯示訂單備注的插件.

How can I show the last Order Note on the customer order history? No plugins seem to exist for Order Notes to be shown on the customer side.

理想的結果:

推薦答案

以下將顯示最后的管理員訂單備注到我的帳戶查看訂單頁面:

The following will display last admin order note to my account view orders pages:

add_filter( 'woocommerce_get_order_item_totals', 'account_view_order_last_order_note', 10, 3 );
function account_view_order_last_order_note( $total_rows, $order, $tax_display ){
    // For "completed" orders on my account view order pages
    if( $order->has_status('completed')  && is_wc_endpoint_url( 'view-order' ) ){

        // Get last order note
        $latest_notes = wc_get_order_notes( array(
            'order_id' => $order->get_id(),
            'limit'    => 1,
            'orderby'  => 'date_created_gmt',
        ) );

        $latest_note = current( $latest_notes );

        if ( isset( $latest_note->content ) ) {
            // Add a new row for tracking
            $total_rows['order_tracking'] = array(
                'label' => __('Tracking:','woocommerce'),
                'value' => $latest_note->content
            );
        }
    }

    return $total_rows;
}

代碼位于活動子主題(或活動主題)的 function.php 文件中.經測試有效.

Code goes in function.php file of your active child theme (or active theme). Tested and works.

這篇關于在客戶訂單歷史記錄中顯示最后的 WooCommerce 管理員訂單備注的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產品的總訂單數)
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗證問題中添加自定義注冊字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產品中添加一個將更改價格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 中文字幕在线播放第一页 | 欧美日韩精品一区二区三区四区 | 亚州激情 | 日韩欧美三级 | 男人天堂视频在线观看 | 人妖videosex高潮另类 | 亚洲综合资源 | 91精品国产欧美一区二区 | 九九热免费看 | 日韩欧美国产一区二区 | 日韩视频一区 | 欧美日韩国产中文字幕 | 欧美精品乱码久久久久久按摩 | 欧美性受 | 成人免费观看视频 | 国产成人精品久久二区二区91 | 精品久久久久久久久久久久久久 | 高清亚洲 | 国产成人综合在线 | 二区av | 精品一区精品二区 | 中文字幕第十一页 | 91精品久久久 | 色香蕉在线 | 天天操综合网 | 99精品视频在线观看免费播放 | 综合久久av | 久久精品免费一区二区三 | 国产精品久久a | 亚洲国产欧美在线 | 久久精品视频网站 | 综合一区二区三区 | 欧美在线观看一区 | 99国内精品久久久久久久 | 欧美专区在线视频 | 欧产日产国产精品v | 精品国产女人 | 国产成人福利在线观看 | 日本三级全黄三级三级三级口周 | 国产精品.xx视频.xxtv | 国产一区 |