1. Home
  2. Docs
  3. FAQs
  4. Customizations
  5. Modify VAT tax by listing author

Modify VAT tax by listing author

Add new custom input field on listing type post, then the field will be showing on submit/edit listing page. Which allow author add their custom VAT tax value

To modify VAT tax by value added from the custom field (by author of the listing) you have to use esb_listing_vat filter hook with default value and listing’s post_id variables.

Add the code bellow to your child-theme’s functions.php file

add_filter( 'esb_listing_vat', function($vat_value, $listing_id){
    if( get_post_meta($product_id, ESB_META_PREFIX.'custom_vat', true) !== '' ){
        return (float) get_post_meta($product_id, ESB_META_PREFIX.'custom_vat', true);
    }
    // return default value if there is no custom_vat value
    return $vat_value;
}, 10, 2 );

Then you will see the change on listing checkout page.