How to Add an Additional charge as a Fee based on Country at your WooCommerce Store for Free using a Simple Code Snippet?

In this article, we take a look at how we can implement an additional fee based on the country in your WooCommerce store using a simple code snippet.

If you want to charge WooCommerce additional fees on checkout based on your country in your WooCommerce store, you can make use of this code snippet.

add_action( 'woocommerce_cart_calculate_fees','elex_add_gst_fee' );

function elex_add_gst_fee($cart) {

if(is_checkout() && WC()->customer->get_shipping_country() == 'IN') {

$fee = (18/100) * $cart->subtotal;

$cart->add_fee( 'GST (18%)', $fee );

}

}

In this above example code, whenever the country is selected as IN or India, an extra GST fee is added to the price.

To Wrap Up,

The code can be modified according to the country and the extra fees you want to add. You can also modify the WooCommerce payment method depending on the country chosen.

Previous How to Hide Profile Picture Options in the WSDesk Mobile View ?
Next How to Hide WooCommerce Payment Methods based on Country for Free using a Simple Code Snippet?

    Leave a Reply

    WordPress Image Lightbox Plugin