Vat not apply on Single product in Woocommerce

wordpress

#1

I want to apply VAT on Product. But problem that i am facing it apply on Variable products not a on single product.

I use this code.

// Fix for PHP Fatal error:  Call to undefined function YIT_Pointers() in \plugins\yith-woocommerce-wishlist\includes\class.yith-wcwl-admin-init.php
if ( ! function_exists( 'is_plugin_activate' )){
    require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
if( is_plugin_active('yith-woocommerce-wishlist/init.php') ){
    if( ! class_exists( 'YIT_Pointers' ) ){
        require_once( get_template_directory() . '/woocommerce/yit-pointers.php' );
    }
}


function edit_price_display() {
  $product = new WC_Product( get_the_ID() );
  $price = $product->price;
 
  $price_incl_tax = $price + round($price * ( 20 / 100 ), 2);
   
  $price_incl_tax = number_format($price_incl_tax, 2, ",", "."); 
  $price = number_format($price, 2, ",", "."); 
 
  $display_price = '<span class="price">';
  $display_price .= '<span class="amount">£ ' . $price_incl_tax .'<small class="woocommerce-price-suffix"> incl VAT</small></span>';
  $display_price .= '<br>';
  $display_price .= '<span class="amount">£ ' . $price .'<small class="woocommerce-price-suffix"> excl VAT</small></span>';
  $display_price .= '</span>';
 
  echo $display_price;
}
 
add_filter('woocommerce_price_html', 'edit_price_display');
add_filter('woocommerce_variable_price_html', 'edit_price_display');

If i remove this code then vat won’t apply.

these are my text settings.

Plz help to solve this issue.

Here is website link : https://budgetmedical.apps-1and1.net


#2

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.