1. Home
  2. FAQs
  3. Customizations
  4. 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.

How can we help?