add_action( 'woocommerce_before_checkout_billing_form', 'display_shipping_notice' );
function display_shipping_notice() {
echo 'Please allow 5-10 business days for delivery after order processing.';
}
add_action( 'woocommerce_after_checkout_form', 'show_shipping_notice_js' );
function show_shipping_notice_js(){
?>
jQuery(document).ready(function($){
// Set the country code (That will display the message)
var countryCode = 'GB';
$('select#billing_country').change(function(){
selectedCountry = $('select#billing_country').val();
if( selectedCountry == countryCode ){
$('.shipping-notice').show();
}
else {
$('.shipping-notice').hide();
}
});
});
Подробнее здесь: [url]https://stackoverflow.com/questions/65809171/show-custom-message-in-woocommerce-checkout-based-on-shipping-country[/url]
В настоящее время я использую приведенный ниже код, чтобы показать собственное сообщение в зависимости от страны: [code]add_action( 'woocommerce_before_checkout_billing_form', 'display_shipping_notice' ); function display_shipping_notice() { echo 'Please allow 5-10 business days for delivery after order processing.'; }
add_action( 'woocommerce_after_checkout_form', 'show_shipping_notice_js' ); function show_shipping_notice_js(){ ?>
jQuery(document).ready(function($){ // Set the country code (That will display the message) var countryCode = 'GB';