---
title: How Include and Exclude Rules Work
description: How Include and Exclude rules work for WooCommerce payment gateways, with several items in the cart and worked examples.
url: "https://wpfactory.com/docs/woocommerce-payment-include-exclude-rules/"
updated: "2026-09-27"
category: How to
---

# How Include and Exclude Rules Work

In [Payment Methods by Product & Country for WooCommerce](https://wpfactory.com/item/payment-gateways-per-product-for-woocommerce/), each gateway has two fields. Include shows the gateway only when the cart contains a matching item, and Exclude hides it when the cart contains one. Empty fields are ignored. Use one approach per gateway, because the same term in both fields cancels out. This applies to categories, tags, and products.

### The two fields

| Field | Meaning |
| --- | --- |
| **Include** | Show this gateway *only* when the cart contains a matching item. If the cart has no matching item, the gateway is hidden. |
| **Exclude** | Hide this gateway when the cart contains a matching item. Otherwise the gateway is left as it was. |

An empty field is ignored, so a gateway with both fields empty is never touched by that section.

### Two ways to run a gateway

- **Hide all except:** put the matching terms in **Include**. The gateway then appears only for those categories, tags or products.
- **Allow all except:** put the matching terms in **Exclude**. The gateway appears everywhere except for those.

Choose one approach per gateway. Do not put the same term in both Include and Exclude for one gateway: the two rules cancel each other out and the gateway is left unchanged.

### What happens with several items in the cart

The plugin checks each gateway against every product in the cart. If any item in the cart triggers a rule that removes the gateway, that gateway is hidden for the whole cart. This is why a cart mixing products with different rules can end up with a short payment list, or none at all. See the mixed-cart troubleshooting article, and consider the Pro fallback gateway so a conflicting cart always keeps one option.

### Worked examples

- **Bank transfer only for one category:** in Product Categories, add that category to Direct Bank Transfer's **Include** field, and to every other gateway's **Exclude** field. Now that category checks out with bank transfer alone.
- **No cash on delivery for expensive tags:** in Product Tags, add your *high-value* tag to Cash on Delivery's **Exclude** field. Everything else is unaffected.

### Where to set the rules

Open **WPFactory > Payment Gateways per Products** (also reachable at **WooCommerce > Settings > Payment Gateways per Products**) and use the tab that matches your target. Category and tag rules are free; product rules require Pro.

### Get more control

Category and tag rules are free. [Payment Methods by Product & Country for WooCommerce](https://wpfactory.com/item/payment-gateways-per-product-for-woocommerce/) Pro adds per-product, per-country and fallback rules. [See what Pro unlocks](https://wpfactory.com/item/payment-gateways-per-product-for-woocommerce/).

Related articles

- [Pro Rules: Products, Tags and Countries](https://wpfactory.com/docs/products-tags-countries/)
- [Optimize Checkout with Payment Rules by Product](https://wpfactory.com/docs/boost-checkout-gateways/)
- [Set Payment Methods from the Product Edit Page](https://wpfactory.com/docs/woocommerce-payment-methods-product-edit-page/)
- [Payment Methods by Product & Country: Reset a Settings Section](https://wpfactory.com/docs/payment-gateways-reset-a-settings-section/)
- [Restrict Payment Gateways by Billing Country](https://wpfactory.com/docs/restricting-gateways-country/)
