Role Based Methods

Control which payment gateways and shipping methods each WordPress role sees at checkout. Built for B2B stores, wholesalers, and multi-tier shops.


Installation

  1. Download the plugin ZIP from your Addnetic account.
  2. In WordPress, go to Plugins → Add New → Upload Plugin.
  3. Select the ZIP file and click Install Now.
  4. Click Activate Plugin.

After activation, a new Role-Based Methods submenu appears under WooCommerce in the admin sidebar.


Requirements

RequirementMinimum version
WordPress6.2
WooCommerce8.2 (must be active)
PHP8.1

Compatibility

  • HPOS (High-Performance Order Storage) — fully compatible, declared via FeaturesUtil
  • Cart & Checkout Blocks — fully compatible, declared via FeaturesUtil
  • Redis / persistent object cache — safe. The plugin queries the database directly, bypassing the object cache to prevent stale data
  • Multisite — each site has its own rules table (wp_X_pm_wc_role_methods)
  • Third-party shipping methods — any method registered through the WooCommerce Shipping Method API is automatically detected

Languages

The admin interface is translated into:

  • English
  • Italian
  • French
  • Spanish
  • German

Additional translations can be added via standard WordPress .po/.mo files using the text domain pm-wc-role-methods.


Getting started

Navigate to WooCommerce → Role-Based Methods. The plugin loads a toggle matrix where:

  • Rows are WordPress user roles (plus a Guest pseudo-role for non-logged-in visitors)
  • Columns are your active payment gateways and shipping methods

Toggle any cell to enable or disable that method for that role. Changes save instantly via the REST API — no page reload, no "Save" button.

The plugin uses a whitelist model: a method is visible at checkout only if it has been explicitly enabled for the user's role. Methods with no rules are hidden by default. This is a secure-by-default approach — nothing is visible until you enable it.

When you first open the matrix, all toggles are off. Enable each method for the roles that should see it at checkout.


Payment gateways

The Payment tab shows all enabled WooCommerce payment gateways. Each gateway appears as a column, and each role as a row.

A gateway is visible at checkout only if at least one of the customer's roles has it enabled. If no rules exist for a gateway, WooCommerce default behavior applies (visible to everyone).

Supported gateways include all standard WooCommerce gateways and third-party gateways registered through the WooCommerce API:

  • Direct bank transfer (BACS)
  • Check payments
  • Cash on delivery
  • Stripe, PayPal, and any other gateway plugin

Shipping methods

The Shipping tab shows all shipping method instances across all WooCommerce shipping zones. Methods are grouped by zone for clarity.

Each shipping method instance is identified by its method_id:instance_id format (e.g., flat_rate:1, free_shipping:3). The plugin works with:

  • Standard zone methods — flat rate, free shipping, local pickup
  • Rest of the World (zone 0) — the catch-all zone
  • Non-zone methods — legacy shipping methods that don't support zones
  • Any third-party shipping method — as long as it's registered through the standard WooCommerce Shipping Method API, the plugin will detect it automatically

The filtering logic is the same as payment gateways: a method is visible if at least one of the customer's roles has it enabled.


Guest role

The plugin adds a Guest pseudo-role for visitors who are not logged in. This role appears first in the matrix and lets you:

  • Hide certain payment methods from anonymous visitors (e.g., show bank transfer only to registered customers)
  • Restrict shipping options for guests (e.g., no "pickup at warehouse" for non-logged-in users)

The Guest role is automatically assigned when is_user_logged_in() returns false.


Multiple roles

WordPress allows users to have multiple roles. When a user has more than one role, the plugin uses OR logic (most permissive):

A method is visible if any of the user's roles has it enabled.

For example, if a user has both customer and wholesale roles:

  • customer has PayPal disabled
  • wholesale has PayPal enabled
  • Result: PayPal is visible at checkout

This is the safest default for multi-role setups — no method is accidentally hidden from a user who should have access to it.


Column filters

Each method column has a filter dropdown with three options:

  • Show all — display all roles (default)
  • Enabled — show only roles that have this method enabled
  • Disabled — show only roles that have this method disabled

Column filters help you audit complex configurations at a glance. For example, you can quickly see which roles can use "Cash on Delivery" by filtering that column to "Enabled only."


Migration tool

If you're switching from "Role Based Payment / Shipping Methods for WooCommerce" by WP BackOffice, the plugin can import your existing configuration in one click.

How it works

  1. Go to WooCommerce → Role-Based Methods → Settings tab.
  2. The plugin auto-detects whether legacy configuration exists.
  3. If found, it shows the number of payment and shipping rules detected.
  4. Click Import Configuration to migrate.

What gets imported

  • All role-to-payment-gateway mappings
  • All role-to-shipping-method mappings
  • Role name-to-slug normalization (the legacy plugin stores display names; ours uses slugs)
  • For shipping methods, the import uses your current WooCommerce methods, so new methods added after the legacy config was saved are also included and set to disabled

What doesn't get imported

  • Group-based rules are not supported and will be skipped with a warning. Groups are a legacy feature that maps to WooCommerce customer groups — a concept not natively supported by WooCommerce.

Important: Importing replaces your entire existing configuration. The current rules are deleted and replaced with the imported ones. This action cannot be undone. We recommend creating a full database backup before importing.


For developers

WooCommerce hooks

The plugin filters checkout methods through standard WooCommerce hooks at default priority (10). If you need to run your own logic after the plugin's filtering, use a higher priority number.

HookTypeDescription
woocommerce_available_payment_gatewaysFilterFilters payment gateways based on role rules
woocommerce_package_ratesFilterFilters shipping methods based on role rules

REST API

The plugin exposes a REST API under the pm-wc-role-methods/v1 namespace. All endpoints require the manage_woocommerce capability and use standard WordPress REST authentication (nonce or application password).

GET /config

Returns roles, payment methods, shipping methods, and all rules in a single request.

{
  "roles": [
    { "slug": "guest", "name": "Guest (not logged in)" },
    { "slug": "customer", "name": "Customer" }
  ],
  "payment_methods": [
    { "id": "bacs", "title": "Direct bank transfer" }
  ],
  "shipping_methods": [
    {
      "id": "flat_rate:1",
      "title": "Flat rate",
      "method_type": "flat_rate",
      "zone_id": 1,
      "zone_name": "Italy",
      "zone_locations": "IT"
    }
  ],
  "rules": {
    "payment": {
      "bacs": { "guest": false, "customer": true }
    },
    "shipping": {
      "flat_rate:1": { "guest": true, "customer": true }
    }
  }
}

PUT /rules

Toggle a single rule:

{
  "method_type": "payment",
  "method_id": "bacs",
  "role": "guest",
  "is_enabled": false
}

PUT /rules/bulk

Batch update multiple rules at once:

{
  "rules": [
    { "method_type": "payment", "method_id": "bacs", "role": "guest", "is_enabled": false },
    { "method_type": "payment", "method_id": "bacs", "role": "customer", "is_enabled": true }
  ]
}

GET /import/detect

Check if legacy configuration exists:

{
  "has_config": true,
  "payment_count": 12,
  "shipping_count": 8,
  "has_groups": false,
  "total_count": 20,
  "last_import": null
}

POST /import/execute

Run the migration from the legacy plugin:

{
  "success": true,
  "imported_count": 20,
  "message": "Successfully imported 20 rules.",
  "import_date": "2026-03-15T10:30:00+00:00"
}