Hi,
Activate cash on delivery payment method in the Woocommerce
After that You can add this code in your them functions.php file
Below code will hide all payment method for Pickup side and only cash on delivery will be allowed
add_filter('woocommerce_available_payment_gateways',function($gateways){
if(is_admin()) return $gateways;
if(!class_exists('pi_dtt_delivery_type')) return $gateways;
$type = pi_dtt_delivery_type::getType();
if($type == 'pickup'){
foreach($gateways as $key => $val){
if($key != 'cod'){
unset($gateways[$key]);
}
}
}
return $gateways;
}, 1);
You can change the title of the payment method using the below code
add_filter( 'woocommerce_gateway_title', function ( $title, $payment_id ){
if(is_admin()) return $gateways;
if(!class_exists('pi_dtt_delivery_type')) return $gateways;
$type = pi_dtt_delivery_type::getType();
if($type == 'pickup'){
if( $payment_id === 'cod' ) {
$title = "Payment on the spot";
}
}
return $title;
}, 100, 2 );