Keep Customers from Using a Gateway at Checkout, but Have It Available for Paying Invoices

Let’s say you have a site where you want customers to be able to add products to the cart and checkout. But you need to manually check the orders before the payment can be accepted. Since the price may change you don’t want to authorize a charge for later capture.

The first part is to let customers check out without paying. WooCommerce has a few “off-line” payment gateways that we can repurpose for this. For this example, we’ll use the check gateway.

We can rename the gateway and provide a description for the customer to see at checkout. They won’t have any idea that we are repurposing something created for checks.

On the front-end, it will look like this.

But we don’t want to offer customers credit card payment at checkout. That’s for later. So we need to remove Stripe from checkout. To do that we can make use of checkout endpoints provided by WooCommerce. We can check and see if the endpoint is the “order-pay” one. This is where a customer will go when they are paying for an already placed order. If it is, then we’ll remove the Check gateway. If it isn’t, then we’ll remove the Stripe one.

add_filter( 'woocommerce_available_payment_gateways', 'ijab_payment_page_gateway_only', 1 );
function ijab_payment_page_gateway_only( $gateway_list ) {
    if ( ! is_wc_endpoint_url( 'order-pay' ) ) {
	} else {
    return $gateway_list;

To use this snippet, you can add it to your theme’s functions.php file or use a plugin like Code Snippets to add it to your site. When it’s active, it will set our payment options like these screenshots.

Order Pay

So now if you ever need to only allow credit card payments when a customer is paying for an order and not at checkout, you know how.

Leave a Reply

%d bloggers like this: