
內容簡介
<strong>外掛總結:</strong>
<p>Category Children Coupons for WooCommerce提供了對WooCommerce內建優惠券類別限制的完全替代方案,並增加了更多彈性。</p>
<ul>
<li><strong>問題:</strong>這個外掛如何提供更靈活的類別限制?</li>
<li><strong>答案:</strong>它包括包含子類別模式和排除子類別模式,以及未來證明 coupons。</li>
<li><strong>問題:</strong>Category Children Coupons for WooCommerce具有哪些功能?</li>
<li><strong>答案:</strong>它包括四個類別限制字段,自動子類別處理,與WooCommerce的其他限制和AutomateWoo兼容性等功能。</li>
<li><strong>問題:</strong>如何運作這個外掛?</li>
<li><strong>答案:</strong>在選擇父類別時,該外掛會自動包含所有子類別進行驗證,並在使用時驗證已選取的包含子類別。</li>
</ul>
外掛標籤
開發者團隊
② 後台搜尋「Category Children Coupons for WooCommerce」→ 直接安裝(推薦)
原文外掛簡介
Category Children Coupons for WooCommerce provides a complete replacement for WooCommerce’s built-in coupon category restrictions with additional flexibility:
Include children mode: Select a parent category and all its subcategories are automatically included. With WooCommerce’s default restrictions, selecting “Clothing” only matches products directly in that category – not products in “T-Shirts” or “Trousers” subcategories. This plugin includes the entire category tree.
Exclude children mode: Match only the specific categories you select, without including subcategories. This mirrors WooCommerce’s built-in behavior but is managed within this plugin’s unified interface.
Future-proof coupons: The plugin stores your category selection and dynamically expands child categories at validation time – new subcategories are automatically included (or excluded) without editing existing coupons.
Features
Four category restriction fields for complete control:
Product categories (incl. children) – allowed categories with all descendants
Exclude categories (incl. children) – blocked categories with all descendants
Product categories (excl. children) – allowed categories only, no descendants
Exclude categories (excl. children) – blocked categories only, no descendants
Automatic subcategory handling based on your preference
Works alongside WooCommerce’s other (non-category coupon) restrictions
Customizable error messages via filter
AutomateWoo compatibility – category restrictions are copied when generating coupons from templates
How It Works
When you select a category in an “(incl. children)” field, the plugin automatically includes all subcategories during validation. When you use an “(excl. children)” field, only the exact categories you select are matched. Selected categories with children included are validated at usage time, so the current children are automatically used, even if they have changed since the coupon was set up.
Filters
runthings_category_children_coupons_error_message
Customize the error message shown when a coupon fails category validation.
Parameters:
$message (string) – The default error message.
$context (array) – Contains ‘coupon’ (WC_Coupon object) and ‘type’ (‘allowed’, ‘excluded’, ‘allowed_excl’, or ‘excluded_excl’).
Example:
See readme.md on GitHub for detailed code examples.
Additional Notes
Built by Matthew Harris of runthings.dev, copyright 2025.
Visit runthings.dev for more WordPress plugins and resources.
Contribute or report issues at the GitHub repository.
Icon – Discount by Gregor Cresnar, from Noun Project, https://thenounproject.com/browse/icons/term/discount/ (CC BY 3.0)
Icon – Tree view by Paweł Gleń from Noun Project, https://thenounproject.com/browse/icons/term/tree-view/ (CC BY 3.0) – https://thenounproject.com/icon/tree-view-3894745/
