I have a WooCommerce shop (running local) but I want to remove the payment gateways. The customer should be able to place an order without paying any cent, I will send them
Leave 'Cash on Delivery' enabled, and it won't take a payment at the checkout. You can easily change the 'Cash on Delivery' titles and labels to something like 'No Payment Required' or similar.
Just add this line in functions.php in your theme:
add_filter('woocommerce_cart_needs_payment', '__return_false');
Other option would be using BACS payment method, where you could explain the client that he will be invoiced later.
You can even add some info at the email that is sent when BACS is used.
Something that the other answers to this question haven't addressed is the fact that you need a way for the customer to eventually pay the invoice. Using Cash on Delivery (renamed to suit your needs) perfectly accomplishes not having the user actually pay at checkout, but the problem is that if Cash on Delivery was your only payment method, it will still be the only payment method when you send them the invoice.
I think in most cases you're going to want only cash on delivery during the cart checkout, and a different payment method (like Stripe) for the invoice payment method.
Here's the full workflow to create a deferred payment setup.
Use the following filter to turn on and off gateways based on whether or not you're on the order-pay
endpoint (the page used for invoice payments).
/**
* Only show Cash on Delivery for checkout, and only Stripe for order-pay
*
* @param array $available_gateways an array of the enabled gateways
* @return array the processed array of enabled gateways
*/
function so1809762_set_gateways_by_context($available_gateways) {
global $woocommerce;
$endpoint = $woocommerce->query->get_current_endpoint();
if ($endpoint == 'order-pay') {
unset($available_gateways['cod']);
} else {
unset($available_gateways['stripe']);
}
return $available_gateways;
}
add_filter( 'woocommerce_available_payment_gateways', 'so1809762_set_gateways_by_context');
Of course, if you're using a gateway other than stripe for the order-pay
page, you'll want to make sure that you update unset($available_gateways['stripe']);
to the proper array key.
After that, you should be good to go! Your site will now display different gateways based on whether or not you're on the invoice pay page!