0
使用下面的代碼將輸出0
此類別有一個子類別,當我使用該子類別的ID時,它返回17
。WooCommerce國家貓及其子類內的產品總數
我想要做的是獲得父類別的總產品,其中也包括子類別的數量。
$term = get_term(16, 'product_cat'); // <--- tested in my system with this ID
echo 'Product Category: '. $term->name. ' - Count: '. $term->count;