Setting up your payment gateways is one of the first things you should do when building your WooCommerce store. When it comes to paying for their goods, bank transfers aren’t always a safe or easy alternative.
There are two primary ways to modify your WooCommerce payment gateways.
- WooCommerce default settings in the Dashboard
- payment gateways in Programmatically code
Method 1: Set payment gateways in woocommerce
Navigate to and click on the Payments tab inside the WooCommerce > Settings>Payments section of the WordPress dashboard. Here you will find all of the payment gateways that have been enabled for your website.
Set Cash On Delivery ( COD ) By default payment option
Select the manage option on the cash-on-delivery option.
Steps to manage Cash on delivery option
- Enable COD: tickmark on eneble checkbox
- Title: Write the title shown to the customer on checkout
- description: Write info shown to customers when they choose the COD option.
- Instruction: write how that works
- Enable shipping methods
- Enable “Accept for virtual orders”
Method 2: Payment gateways title and description Programmatically code
Paste this code in the functions.php file in your website theme.
Step 1: Change Title
<?php
add_filter( 'woocommerce_gateway_title', 'cxc_change_cod_payment_gateway_title', 25, 2 );
function cxc_change_cod_payment_gateway_title( $title, $gateway_id ){
if( 'cod' === $gateway_id ) {
$title = 'Cxc Cash on delivery';
}
return $title;
}
?>
Step 2: Change Description
<?php
add_filter( 'woocommerce_gateway_description', 'cxc_change_cod_payment_gateway_description', 25, 2 );
function cxc_change_cod_payment_gateway_description( $description, $gateway_id ) {
if( 'cod' === $gateway_id ) {
// you can use HTML tags here
$description = 'Cxc Pay with cash upon delivery. cxc-codexcoach.';
}
return $description;
}
?>
Also Read:
How To Disable Payment Gateways For Specific User Roles in WooCommerce
How to add content after or before the ‘add to cart’ button on single product page woocommerce