How to add a additional paragraph under WooCommerce checkout country field

I'd like to add an anchor link below the Country Dropdown in Woocommerce checkout fields.

I use the code below, but unfortunately without the desired result

add_action( 'woocommerce_form_field_text','additional_paragraph_after_billing_country', 10, 4 );
function additional_paragraph_after_billing_country( $field, $key, $args, $value ){
    if ( is_checkout() && $key == 'billing_country' ) {
        $field .= '<p class="form-row sf_add hide-on-desktop hide-on-tablet"><a href="#SF">extra paragraph here</a></p>';
    }
    return $field;
}

Image for illustration:

enter image description here


Any advice would be appreciated

Solutions

If you want to add additional paragraph under a country field, you should use the woocommerce_form_field_country hook opposite woocommerce_form_field_text

More explanation can be found in: How should I change the woocommerce_form_field HTML Structure?

So you get:

function filter_woocommerce_form_field_country( $field, $key, $args, $value ) {
    // Compare
    if ( is_checkout() && $key === 'billing_country' ) {
        $field .= '<p class="form-row sf_add hide-on-desktop hide-on-tablet"><a href="#SF">extra paragraph here</a></p>';
    }
    
    return $field;
} 
add_filter( 'woocommerce_form_field_country', 'filter_woocommerce_form_field_country', 10, 4 );

Similar questions

Custom shipping method for a specific country based weight in one country
Sorry I didn't try anything as I couldn't even get how to start but basically I am looking for a custom shipping method to work in one country alone. THe shipping company to work with have a working policy of delivering 7kg or less for 1usd in any part of City A, >7kg to <=10kg, 2usd in City A. And so on for other cities in the country. Is there...
Display the name of the billing and shipping country instead of the country code for the current user only
inspired by: Get state name instead of the code in Woocommerce Display a preview of the custom field data in the Edit Billing and Shipping Address section on the my account page And in the answers of the friend @LoicTheAztec I intend to show the name of the country in the section (Edit Billing and Shipping Address) of the page my account with the f...
Adding shipping costs based on quantity of products in Woocommerce cart that exceed 40EUR. The additional cost differs based on shipping country
This is a little function I'm writing for adding additional shipping costs based on amount of products in cart whose price is more than 40EUR. screenshot of my code I got to the point where the function calculates how much should be added to shipping, now I need to 1) actually add it to shipping cost 2)have it run every time cart is updated 3) intr...
Making woocommerce checkout form state field not required based on selected country
I have a WordPress+Woo-commerce site and I want to make the state field on the checkout form optional based on the selected country. For example I want my customers to add state field only if they belong to one of U.S.A. states. How do I do this?
Make state checkout field required for a Vietnam country in WooCommerce
The country of Vietnam in WooCommerce does not have defined states, so I added some states to my checkout page. This is my code: It do work as I would like, but it is an optional field for Vietnam. How to make this state field as required for Vietnam? Any help is appreciated.
Make Woocommerce checkout phone field optional based on shipping country
In Woocommerce checkout, I am trying to make the phone field not required for specific shipping countries. Based on "Make checkout phone field optional for specific countries in WooCommerce" answer code, which works fine, I have tried to make some changes to get this code working for the shipping country rather than billing country. After a lot of ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.