• I have added other shipping methods like Free Shipping and local pickup, but now Shipping Rates by City is last in the list, I want it to be the first and preselected as default, I don’t find how to do this, if you could help please by doing some method Hook.

    function reset_default_shipping_method( $method, $available_methods ) {
    
        // If the shipping method has been chosen don't do anything
        if ( ! empty( $method ) ) {
            return $method;
        }        
    
        // add code to set 'Table Rate' as the default shipping method 
    
        $method = 'table_rate-5';
    
        return $method;    
    }
    
    add_filter('woocommerce_shipping_chosen_method', 'reset_default_shipping_method', 10, 2);
    • This topic was modified 2 years, 5 months ago by Anuar.
  • The topic ‘Changing the default shipping method to “Shipping Rates by City”’ is closed to new replies.