Created
October 1, 2019 05:51
-
-
Save KoolPal/ba0dce676b522fd8a202c70de0956ff6 to your computer and use it in GitHub Desktop.
Retain Quote Billing & Shipping Country ELSE assign Location based on IP (Geolocation)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 06-05-2019 Retain Quote Billing & Shipping Country ELSE assign Location based on IP (Geolocation) | |
function remove_checkout_optional_fields_label_script() { | |
// Only on checkout page | |
if( ! ( is_checkout() && ! is_wc_endpoint_url() ) ) return; | |
$optional = ' <span class="optional">(' . esc_html__( 'optional', 'woocommerce' ) . ')</span>'; | |
?> | |
<script> | |
jQuery(function($){ | |
// On "update" checkout form event remove option to select countries | |
$(document.body).on('update_checkout', function(){ | |
$('#billing_country_field label > .optional').remove(); | |
$('.woocommerce-checkout #billing_country_field').css('pointer-events', 'none'); | |
$('#shipping_country_field label > .optional').remove(); | |
$('.woocommerce-checkout #shipping_country_field').css('pointer-events', 'none'); | |
}); | |
}); | |
</script> | |
<?php | |
} | |
add_filter( 'wp_footer' , 'remove_checkout_optional_fields_label_script' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment