Payment Method Rules for OpenCart 4 and 3: Show Payment Methods by Customer Group, Total and Category (Free Extension)
Limit Cash on Delivery, Bank Transfer and other payment methods by customer group, sub-total, shipping method and category, in OpenCart 4 and 3.

OpenCart lets you limit a payment method by geo zone and order total, and that’s about it. Real stores need more. Cash on Delivery is fine for a $40 order but risky for a $900 one. Bank Transfer makes sense for wholesale accounts, not for every guest. And some products, like expensive cameras, should never ship COD at all.
Payment Method Rules is a free extension that adds those conditions. You write a rule per payment method: which customer groups can use it, the cart sub-total range, which shipping methods it works with, and which categories block it. At checkout, a method only shows up when its rule matches. It comes in two builds, one for OpenCart 4.1.0.4 and one for OpenCart 3.0.5.1, and we tested both on real checkouts.
Download Payment Method Rules
- OpenCart 4.1.0.4: paymentrules.ocmod.zip for OpenCart 4
- OpenCart 3.0.5.1: paymentrules.ocmod.zip for OpenCart 3

What each rule can check
- Payment method: any installed payment extension, such as Cash On Delivery, Bank Transfer, Cheque or PayPal.
- Only for customer groups: tick the groups that may use it. Leave all unticked for any group. Guests are matched by the customer group they picked at checkout, or the store’s default group.
- Only when the cart sub-total is at least / at most: the sub-total before shipping and taxes, in your default currency. Leave a box empty for no limit.
- Only with shipping methods: for example, allow COD only with Store Pickup. This is only checked when the cart needs shipping, so downloads and gift cards aren’t blocked.
- Hide when the cart has products from: one or more categories. If any product in the cart is in one of them, the method is hidden.
- Admin note: a reminder for yourself, such as “COD only for local orders under $200”.
Every filled-in condition must match. Empty conditions are ignored, and payment methods without a rule are left alone. That makes it safe to install: until you add a rule, nothing changes.
Install in OpenCart 4
- Go to Extensions > Installer, upload
paymentrules.ocmod.zipand click the green +. - Go to Extensions > Extensions, choose Modules, and install Payment Method Rules.
- Click the blue pencil to edit it, turn Status on, click Add rule and fill in the conditions. Save.
Install in OpenCart 3
- Go to Extensions > Installer and upload
paymentrules.ocmod.zip. No modification refresh is needed. - Go to Extensions > Extensions, choose Modules, and install Payment Method Rules.
- Edit it, set Status to Enabled, add your rules and click Save.

What happened when we tested it
We used the two rules from the screenshot above on both stores, with Cash On Delivery and Bank Transfer enabled, and ran real checkouts with iPhones ($101 each in the demo data) and the Canon EOS 5D from the Cameras category.
| Cart | Customer group | Payment methods shown |
|---|---|---|
| 2 iPhones, $202 sub-total | Default | Cash On Delivery only |
| 3 iPhones, $303 sub-total | Default | None |
| 3 iPhones, $303 sub-total | Wholesale | Bank Transfer only |
| iPhone and Canon EOS 5D | Default | None |
The results were the same on OpenCart 4.1.0.4 and 3.0.5.1. Bank Transfer was hidden for the Default group in every case, because its rule only allows Wholesale.


Be careful with rules that can hide every method. With a $303 cart and a regular account, both methods were hidden, and OpenCart showed its own message: “No Payment options are available. Please contact us for assistance!” The customer can’t finish the order. Keep at least one method without limits, such as a card gateway, unless that’s what you want.

How it works
The extension doesn’t touch core files or payment extensions. In OpenCart 4 it adds one event on catalog/model/checkout/payment_method.getMethods/after. OpenCart builds the list of available methods, and the event removes the ones whose rule doesn’t match:
$cart = $this->cartFacts();
foreach ($rules as $rule) {
$code = $rule['payment'] ?? '';
if (isset($output[$code]) && !$this->matches($rule, $cart)) {
unset($output[$code]);
}
}
The rule check itself is short. Each condition only runs if you filled it in:
private function matches(array $rule, array $cart): bool {
if (!empty($rule['customer_group']) && !in_array($cart['customer_group_id'], array_map('intval', $rule['customer_group']))) {
return false;
}
if (($rule['total_min'] ?? '') !== '' && $cart['subtotal'] < (float)$rule['total_min']) {
return false;
}
if (($rule['total_max'] ?? '') !== '' && $cart['subtotal'] > (float)$rule['total_max']) {
return false;
}
// Shipping only matters when the cart needs shipping.
if (!empty($rule['shipping']) && $cart['has_shipping'] && !in_array($cart['shipping'], $rule['shipping'])) {
return false;
}
if (!empty($rule['category']) && array_intersect($cart['categories'], array_map('intval', $rule['category']))) {
return false;
}
return true;
}
OpenCart 3 has no single “get all methods” model call. Each payment extension has its own getMethod(), so the OpenCart 3 build registers one wildcard event, catalog/model/extension/payment/*/getMethod/after, and empties the result for a method whose rule fails:
if (!preg_match('#^extension/payment/([a-z0-9_]+)/getMethod$#', $route, $match)) {
return;
}
$rules = $this->config->get('module_paymentrules_rule');
if (!is_array($rules)) {
return;
}
$cart = null;
foreach ($rules as $rule) {
if (!isset($rule['payment']) || $rule['payment'] != $match[1]) {
continue;
}
if ($cart === null) {
$cart = $this->cartFacts();
}
if (!$this->matches($rule, $cart)) {
$output = array();
return;
}
}
Because the filtering happens where OpenCart builds the list, the rules also apply when an admin creates an order, since the admin order screen uses the same catalog code.
Ideas for rules
- COD for local pickup only: Cash On Delivery, shipping method Store Pickup.
- No COD on big orders: Cash On Delivery, sub-total at most 300.
- Invoice payment for trade accounts: Bank Transfer or Cheque, customer group Wholesale.
- No pay-later on high-risk products: your buy-now-pay-later method, hidden for the categories where fraud happens most.
Related posts
- OpenCart 4: set a default shipping method
- Multiple flat rates by order total for OpenCart 4
- OpenCart 4 tax and VAT setup
- OpenCart events by examples
Please let us know if you have any questions or suggestions, and subscribe to our YouTube channel for more OpenCart video tutorials. You can also find us on Twitter and Facebook.







