How do I disable “Flat Rate” radio button and remain with other shipping method in woocommerce

You need to modify the values of these below variables of your code-

// HERE define your shipping class to find
$class = 92;

// HERE define the shipping method to hide
$method_key_id = 'flat_rate:7';

Though the author of source answer clarified how to get these above things in the answer, here I’m putting these again.

Finding the shipping class ID.

1) In the database under wp_terms table:

Search for a term name or a term slug and you will get the term ID (the shipping class ID).

2) On Woocommerce shipping settings editing a “Flat rate”, with your browser html inspector tool, inspect a shipping Class rate field like:

enter image description here

In the imput name attribute you have woocommerce_flat_rate_class_cost_64. So 64 is the ID for the shipping class.


Get the shipping method rate ID:

To get the related shipping methods rate IDs, something like flat_rate:12, inspect with your browser code inspector each related radio button attribute name like:

enter image description here