Ajax 将样式添加到购物车/Woocommerce中的迎头国家/地区更改

Ajax 将样式添加到购物车/Woocommerce中的迎头国家/地区更改,ajax,class,woocommerce,Ajax,Class,Woocommerce,我想隐藏一个元素,如果选择的计费或装运国家是“新西兰”。下面我有一段简单的代码,在页面刷新后非常有效: function hide_tax() { if( WC()->customer->get_shipping_country() !== 'NZ' || WC()->customer->get_billing_country() !== 'NZ' ) { echo '<style>.includes_tax{display:none

我想隐藏一个元素,如果选择的计费或装运国家是“新西兰”。下面我有一段简单的代码,在页面刷新后非常有效:

function hide_tax() {
    if( WC()->customer->get_shipping_country() !== 'NZ' || WC()->customer->get_billing_country() !== 'NZ' ) {
        echo '<style>.includes_tax{display:none !important;}</style>';
    }
}
add_action( 'wp_head', 'hide_tax' );
函数隐藏税(){
如果(WC()->customer->get_shipping_country()!='NZ'|| WC()->customer->get_billing_country()!='NZ'){
echo'.includes{display:none!important;}';
}
}
添加行动('wp_head','hide_tax');
问题是,在客户选择国家/地区后,通过AJAX无法实现这一点。仅在页面上刷新。你知道如何修改上面的代码吗?干杯