VAT is removed instead of being 0%

Forums EU/UK VAT Manager for WooCommerce VAT is removed instead of being 0%

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #177887
    Sam De Decker
    Participant

    Hi,

    I see that the VAT is being completely removed when a customer buys with a VAT number while it should be 0% instead.

    Is there any way to fix this?

    Thank you,

    sam

    #178299
    Juwel
    Participant

    This usually happens due to VAT exemption settings or tax class rules in WooCommerce.

    Check if VAT is set to zero rate instead of exemption. Adjust tax rules accordingly.

    If you’re unsure, feel free to contact me and I’ll fix it properly.

    #178865
    Taha
    Moderator
    Plugin Support

    Hi Everyone,

    This is an update regarding a recent forum issue, which has now been addressed via a support ticket. The following clarification and solution are provided for reference.

    The behavior you encountered is the default way WooCommerce handles VAT-exempt orders: when an order is marked as VAT-exempt, WooCommerce removes the tax line entirely instead of displaying a 0% rate. This can cause issues with certain accounting software.
    To ensure compatibility, We’ve prepared a PHP snippet that automatically adds a 0% VAT tax line to VAT-exempt orders. You can add this code to your theme’s functions.php file or use a “Code Snippets” plugin.

    add_action( 'woocommerce_checkout_order_processed', function ( $order_id ) {
    
     if ( ! $order_id ) {
     return;
     }
    
     $order = wc_get_order( $order_id );
     if ( ! $order ) {
     return;
     }
    
     // Check if VAT-exempt
     if ( $order->get_meta( 'is_vat_exempt' ) === 'yes' ) {
    
     // Avoid duplicates
     foreach ( $order->get_items( 'tax' ) as $item ) {
     if ( $item->get_name() === 'EU VAT (Exempt)' ) {
     return; // Already added
     }
     }
    
     // Create 0% VAT tax item
     $item = new WC_Order_Item_Tax();
     $item->set_name( 'EU VAT (Exempt)' );
     $item->set_label( 'VAT' );
     $item->set_tax_total( 0 );
    
    
     // Attach to order
     $order->add_item( $item );
     $order->save();
     }
    
    }, 20 );

    Thank you!

    Best regards,
    Taha

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.