feat(fields): 補 3 個 WC runtime usermeta 欄位
Tests / Integration Tests (push) Successful in 1m7s
Tests / Unit Tests (push) Failing after 14m20s
Tests / PHP Lint (push) Failing after 14m28s

wc_last_active / wc_order_count_<prefix> / last_update 先前未註冊,會落回
wp_usermeta。三者皆由 WooCommerce 在 order/session 事件寫入,繁忙商店為高頻。

wc_order_count 走 Users::update_site_user_meta(),key 是
'wc_order_count' . '_' . rtrim( get_blog_prefix(), '_' );來源外掛寫死主站
形式 'wc_order_count_wp',multisite 子站(_wp_2)會漏接,這裡改用同一條運算式。
This commit is contained in:
2026-07-31 10:18:33 +08:00
parent b9e24814c8
commit 0118fc3a1a
+21
View File
@@ -583,6 +583,27 @@ final class TMDO_WooCommerce {
'type' => 'integer',
'label' => 'WC customer last order ID',
),
// WC runtime stats — written on order/session events, high-frequency
// on busy stores. Unregistered they land back in wp_usermeta.
array(
'key' => 'wc_last_active',
'type' => 'integer',
'label' => 'WC last customer activity timestamp (Unix)',
),
array(
// WooCommerce stores this per-site via Users::update_site_user_meta(),
// which appends the de-suffixed blog prefix ('wc_order_count' + '_wp'
// on the main site, '_wp_2' on a subsite). Compute it the same way
// rather than hardcoding the main-site form.
'key' => 'wc_order_count_' . rtrim( $GLOBALS['wpdb']->get_blog_prefix(), '_' ),
'type' => 'integer',
'label' => 'WC order count for the current site (blog-aware key)',
),
array(
'key' => 'last_update',
'type' => 'integer',
'label' => 'WC customer last profile update timestamp (Unix)',
),
)
);
}