WooCommerce Shipping – Hide shipping methods based on destination country

You might be already using one of the awesome WooCommerce shipping solutions of XAdapter. While shipping internationally, you may want to hide specific shipping methods for certain countries. You can hide the shipping method(s) in the cart/checkout page based on the destination country, using the below code snippet.


Just copy and paste the snippet in Appearance –>Editor –> functions.php and you are done!

If you are looking for a plugin to do this job, visit ELEX Hide Shipping Methods Plugin. Using this plugin, You can easily hide shipping methods based on various conditions.

You have to simply configure the array with the country code as per requirement, and the corresponding shipping method to hide. You can also read this guide on WooCommerce Hide WooCommerce Shipping methods to learn the best ways to do that.



Comments (2)

  • qbaccservweb

    Hi there,
    I am using UPS Shipping plugin with woocommerce product addons plugin.

    Products addons does not have option to enter weight and dimensions so for all thoses products which has product addons configured are not calculating UPS shipping despite the main product has weight and dimensions.
    The following message appears:
    Product #2 is missing weight. Aborting.


    January 30, 2018 at 9:55 am
    • Anindo

      Hi John,

      For fetching real time rates, UPS API needs the weight of the order as a minimum. Hence, if you don’t provide that, you will get an error. In that case, the only option left is to assign a flat rate for these products.

      January 30, 2018 at 3:23 pm

Leave a Reply