How to Enable a Payment Gateway Only for the Order Pay Page in WooCommerce

How to Enable a Payment Gateway Only for the Order Pay Page in WooCommerce
On this page
  1. Why Restrict a Gateway to Order Pay Only
  2. Step 1: Remove the Gateway From Standard Checkout
  3. Troubleshooting
  4. Frequently Asked Questions
  5. Conclusion

You can enable a payment gateway only for the Order Pay page in WooCommerce by filtering the available payment gateways and re-adding a specific method exclusively when the customer is on the pay-for-order endpoint, keeping it hidden from the standard checkout.

Why Restrict a Gateway to Order Pay Only

  • You invoice clients manually and want to offer bank transfer only on that follow-up payment link, not standard checkout
  • Certain payment methods make sense for invoiced or backend-generated orders but not for typical customer-facing purchases
  • It keeps your main checkout streamlined while still supporting a specialized payment flow for specific orders

Step 1: Remove the Gateway From Standard Checkout

PHP
/**
 * Hide Bank Transfer from standard checkout, keep it on Order Pay only
 * Add to your child theme's functions.php
 */
add_filter( 'woocommerce_available_payment_gateways', 'restrict_bank_transfer_to_order_pay' );

function restrict_bank_transfer_to_order_pay( $available_gateways ) {
    if ( is_checkout() && ! is_wc_endpoint_url( 'order-pay' ) ) {
        unset( $available_gateways['bacs'] );
    }
    return $available_gateways;
}
Enable a payment gateway only for the order pay page in WooCommerce: the page before adding the code
Before
Enable a payment gateway only for the order pay page in WooCommerce: the page after adding the code
After

Troubleshooting

The Gateway Is Missing Everywhere, Including Order Pay

Confirm the gateway is actually enabled globally under WooCommerce > Settings > Payments — this snippet only removes it from standard checkout, it doesn’t enable a disabled gateway anywhere.

You Need More Complex Rules Than Just Order Pay

If you need conditions based on cart totals, customer role, or shipping country in addition to this page-specific rule, consider a dedicated conditional payment gateways plugin instead of stacking multiple custom conditionals manually.

The Gateway Shows on Order Pay for the Wrong Orders

If certain manually created orders shouldn’t offer this gateway, add an extra check against the order’s status or a custom meta flag before allowing the gateway through, rather than relying solely on the endpoint check.

Frequently Asked Questions

What is the Order Pay page exactly?

It’s the checkout-like page customers reach via a “pay for this order” link, typically used for manually created orders, invoices, or orders left unpaid that need a follow-up payment link.

Can I do the reverse — hide a gateway only on Order Pay?

Yes, invert the condition to check is_wc_endpoint_url( 'order-pay' ) being true instead of false, then unset the gateway in that case instead.

Does this affect subscription renewal payments?

Renewal payments for subscriptions typically use their own separate payment flow — test specifically with your subscription setup if you rely on WooCommerce Subscriptions alongside this snippet.

Conclusion

A single filter checking the Order Pay endpoint is enough to enable a payment gateway only for the Order Pay page in WooCommerce, keeping specialized payment methods out of your standard checkout flow. For more advanced conditional rules, a dedicated plugin may be worth considering over stacking multiple manual conditions.

See also How to Enable Apple Pay and Google Pay in WooCommerce. Then read How to Enable WooCommerce Payments.

Prefer no code? All-in-One Utilities Woo Add-on adds over 50 WooCommerce features, so you can switch them on without code.

Leave a Reply

Schedule a call