How can I remove a 3rd Party field for non logged in visitors? It is placed in the billing section, but can't accessed with unset code.
This is rendered in the checkout page:
<p class="form-row aelia_wc_eu_vat_assistant vat_number update_totals_on_change address-field form-row-wide" id="vat_number_field" data-priority="250"><label for="vat_number" class=""><strong>VAT number</strong> <span class="optional">(optional)</span></label><span class="woocommerce-input-wrapper"><input type="text" class="input-text " name="vat_number" id="vat_number" placeholder="VAT Number" value="" valid="0" aria-describedby="vat_number-description"><span class="description" id="vat_number-description" aria-hidden="true">Only for Retailers: Enter your EU VAT Number (if any). Country prefix is not required.</span></span></p>
I don't want to use javascript based solution cause of caching.
Updated: You can use the following dedicated filter hook to hide that field from unlogged users:
add_filter( 'wc_aelia_eu_vat_assistant_show_checkout_field_vat_number', 'hide_vat_field_for_unlogged_users', 10, 2 );
function hide_vat_field_for_unlogged_users( $show_field, $is_field_required ) {
if ( ! is_user_logged_in() )
$show_field = false;
return $show_field
}
Code goes in function.php file of your active child theme (or active theme). It should works.
Note: Old hook
wc_aelia_eu_vat_assistant_show_vat_field
is obsolete and replaced.