Check if the Logged-in User Has a Verified VAT Number in WooCommer

How to Check if the Logged-in User Has a Verified VAT Number in WooCommerce

Running an online business is already a hassle.

Costs are everywhere from shipping to marketing to taxes, more costs mean more transactions, more operations, and more hassle.

It would be great if anything could offer a less-hassle option, and that’s what you get when you make a B2B sale in the EU.

But how would you know if your sale is a B2B sale or a B2C one? Would you send a customer survey? Contact customers by email?

That’s not efficient, even if your store purchases are limited it would take so much time that you could use for something more useful.

The question you should ask is: Is there a plugin for that?

And the answer is: yes, there is. And that’s “EU VAT Manager for WooCommerce” which I’ll discuss today.

Let’s go…

What is the EU VAT Manager Plugin for WooCommerce?

It’s one of the most sophisticated plugins in the market for automating VAT settings, validation (VIES), and how to apply taxes, ensuring a seamless and compliant customer experience.

With this plugin in your hands, you can control and automate every detail you could imagine about EU VAT.

It’s one of those things that simplifies e-commerce store management and makes your life as a store owner a lot easier as this plugin runs in the background makes the necessary checks and keeps your store in order collecting the necessary information from your customers about their tax.

Many customers have used and loved this plugin for its flexibility, control, and automation capabilities, and it’s the choice for many when it comes to EU VAT management.

How to Check if the Logged-in User Has a Verified VAT Number in WooCommerce

There are a few options you could follow to check if the logged-in user has a verified VAT number, one of these is enhancing the core functionality of the code of the plugin.

Based on the specific algorithm you would be using in your plugin to check if the user is logged in you will place the code in the most suitable place in the plugin files. Here are some suggestions on where to place your code:

Option 1: Enhance the Core Functionality

If your goal is to integrate the VAT number check directly into the core functionality of the plugin (for example, during the checkout process or when saving user details), you should locate the class-alg-wc-eu-vat-core.php file within the includes directory. This file is likely responsible for handling core VAT-related operations. You can extend this class or add your method within it to include your VAT number check logic.

Option 2: Hook Into Plugin or WooCommerce Actions

Since your plugin interacts with WooCommerce, it may be most effective to hook your code into specific WooCommerce actions or filters that are relevant to when you need the VAT number check to occur. For example, you might want to perform this check during the checkout process or when user profiles are updated. You can add your code in the main plugin file (eu-vat-for-woocommerce.php) using the add_action or add_filter WordPress functions, targeting WooCommerce hooks like woocommerce_checkout_process or woocommerce_save_account_details.

Option 3: Create a New Class or Function File

If your VAT number check functionality is extensive or if you prefer to keep it modular, you might consider adding a new file specifically for this purpose. For instance, create a new PHP file named class-alg-wc-eu-vat-check.php and include it within the includes directory. Then, you can include this file in your main plugin file or within the includes() function of your main Alg_WC_EU_VAT class

Option 4: Add to the Admin Section

If your VAT number check is primarily for administrative purposes or should only run in the WordPress admin area, you might integrate it within the admin() method of your main class. This could be directly within the admin() method or by including a new file that contains your admin-specific checks.


Ensure that your modifications are compatible with future versions of WooCommerce and the EU/UK VAT for the WooCommerce Pro plugin. Keep your changes modular to simplify updates.

Thoroughly test your changes in a staging environment to ensure they work as expected without affecting the plugin’s core functionality or causing conflicts with WooCommerce and other plugins.

By carefully considering the best location for your custom code based on its purpose and how it integrates with existing functionalities, you can enhance your plugin’s capabilities while maintaining a clean and maintainable codebase.

Leave a Reply

Your email address will not be published. Required fields are marked *