I am looking forward for above query. Say a customers places order of two products t shirt by vendor A with flat shipping rate 15% priced at 10$and socks offered by vendor B for 5$ available on Cash on delivery. Freezing payment checkout can be done for specific category and products but output which i desire is Cart total shows 15$ but only for A with options to pay for 10$ other than COD and B is mentioned as COD. (So customer pays only 10$ and rest is mentioned as COD) i tried this but it hides complete payment gateway.Below code tried didnt help

function filter_gateways($gateways){

$payment_NAME = 'dibs'; // cart_contents as $key => $values ) {
// Get the terms, i.e. category list using the ID of the product
$terms = get_the_terms( $values['product_id'], 'product_cat' );
// Because a product can have multiple categories, we need to iterate through the list of the products category for a match
foreach ($terms as $term) {
// 20 is the ID of the category for which we want to remove the payment gateway
if($term->term_id == $category_ID){
// If you want to remove another payment gateway, add it here i.e. unset($gateways['cod']);

return $gateways;