How to add a custom message when paying in WooCommerce according to the selected country

Sometimes you will find in your WooCommerce online store that you need to show a personalized message to customers who select a specific country, either to indicate delivery times above normal, special conditions, discounts or whatever you need or have happen.

The code

If it is your need you can easily achieve it with a code like this:

add_action( 'woocommerce_before_checkout_billing_form', 'ayudawp_mensaje_portugal' );

function ayudawp_mensaje_portugal() {

echo '<div class="shipping-notice woocommerce-info" style="display:none">Orders to Portugal take 3 to 5 business days from the order. </div>';


add_action( 'woocommerce_after_checkout_form', 'ayudawp_mostrar_mensaje_portugal' );

function ayudawp_mostrar_mensaje_portugal(){




var countryCode = 'PT';


selectedCountry = $('select#billing_country').val();

if( selectedCountry == countryCode ){



else {








Where do I put this code?

As it will be a code independent of the theme you use, the ideal is that you create a plugin with the code or add it to your customization plugin.

But you can also add it to the very end of the functions.php file of the active (child) theme.

What can be customized from the code?

In the code you can change the text that will be shown for the one you need, as well as the country, changing the country code. In this link you have all the IBAN codes of each country.

Date update on 2021-02-16. Date published on 2021-02-16. Category: Computer class Author: Oscar olg Fuente: ayudawp