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 shipping method(s) in the cart/checkout page based on destination country, using the below code snippet.

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

You have to simply configure the array with the country code as per requirement, and the corresponding shipping method to hide.

 

 

Comments (2)

  • qbaccservweb
    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.

    Help.
    John

    January 30, 2018 at 9:55 am
    • Anindo
      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