• Apfelbiss

    (@apfelbiss)


    Hello,

    is it possible to show the field description on checkout always and not only, when the customer clicks into the input field?

    Custom CSS like the following doesn’t work, because then the description is sliding and flickering everytime the focus of the input field changes:
    body.woocommerce-checkout #vat_number-description { display: inline-block !important; }

    I have searched the plugin code for the JacaScript, that changes the visibility there, but couldn’t find it by myself.

    Thank you in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author Diego

    (@daigo75)

    The EU VAT Assistant doesn’t hide the description of checkout fields. That’s done by WooCommerce, in script woocommerce/assets/js/frontend/woocommerce.js.

    If I’m not mistaken, the script targets span elements that have a description CSS class. That class is also added automatically by WooCommerce to the description element.

    To change this behaviour, you could try writing a filter for hook woocommerce_form_field and remove the description CSS class from the HTML. That should make WooCommerce ignore that description element, which should always be visible.

    Here’s a template for that hook, based on WooCommerce’ core code:

    
    add_filter('woocommerce_form_field', function($field, $key, $args, $value) {
      // $field contains the HTML of the field, including the <span>
      // element with the CSS class "description" to be removed
    
      // Add your custom logic to alter the $field HTML before returning it
      return $field;
    }, 10, 4);
    

    Please note that we haven’t done that ourselves, therefore we can’t guarantee that it will work. My recommendation would be to check with the WooCommerce support team if this solution is sufficient, or if there is a more elegant one.

Viewing 1 replies (of 1 total)
  • The topic ‘Make EU VAT field description always visible?’ is closed to new replies.