Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Michael Chart 15 posts 35 karma points
    May 29, 2012 @ 17:54
    Michael Chart
    0

    No VAT on orders from non-EC countries

    Since some countries in Europe do not have to pay VAT, I am trying to work out the best way to implement this. This thread seems to address the same issue, but the ITaxService works on a line item basis as opposed to an order as a whole, so there's no way to get the country of the order there.

    What I think I might need to do is to create a pipeline task to replace the Basket.CalculateVATTotal task. Then I could set the purchase order VAT to zero. However I'm not sure what this task does by default. Would I also need to replace the Basket.CalculateOrderTaxTotal task to make sure that no VAT was applied to the shipping either?

    Any advice here would be appreciated.

    Thanks,

    Michael.

     

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 01, 2012 @ 14:10
    Søren Spelling Lund
    0

    ITaxService is indeed what you're looking for.

    Here's a sample of how you could do it. The taxFreeSpecification essentially figures out whether a country is in the EU and whether a VAT no was provided:

    public Money CalculateTax(Product product, PriceGroup priceGroup, PriceGroupPrice unitPrice)
    {
        if (!SiteContext.Current.OrderContext.HasBasket)
            return _defaultTaxService.CalculateTax(product, priceGroup, unitPrice);
    
        var basket = SiteContext.Current.OrderContext.GetBasket(false);
        var billingAddress = basket.PurchaseOrder.GetBillingAddress();
    
        if (billingAddress == null || billingAddress.Country == null)
            return _defaultTaxService.CalculateTax(product, priceGroup, unitPrice);
    
        string companyRegistrationNumber = GetCompanyRegistrationNumber(basket);
        var country = billingAddress.Country;
    
        if (_taxFreeSpecification.IsTaxFreeSatisfiedBy(companyRegistrationNumber, country))
            return new Money(0m, priceGroup.Currency);
    
        return _defaultTaxService.CalculateTax(product, priceGroup, unitPrice);
    }

     

  • Michael Chart 15 posts 35 karma points
    Jun 11, 2012 @ 18:01
    Michael Chart
    0

    Hi Soren,

    Thanks for the response. I have implemented a TaxService similar to yours above. However, when debugging I found that this CalculateTax method seems to only get called when the product page loads.

    Also, it doesn't seem to affect the VAT either!  I inspect the basket object when the cart page loads and the line items all have VAT even after I watched the debugger go through the TaxService and return 0 VAT.

    Does this TaxService apply to products? What about tax on the shipping?

    Many thanks for your help.

    Michael.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jun 18, 2012 @ 13:57
    Søren Spelling Lund
    0

    When we implemented Marketing Foundation we were a little to eager and forgot to use ITaxService in the CalculateOrderLineTax task in the basket pipeline. You'll want to rip out that guy and replace it with your own calculation. Otherwise the value will get overridden by the default logic. This will of course change in an upcoming release.

    Sorry for the inconvenience.

  • Michael Chart 15 posts 35 karma points
    Jun 19, 2012 @ 18:04
    Michael Chart
    0

    Hi Soren,

    Thanks for the reply. How do I know which properties of the Purchase Order I am supposed to set when I am overriding one of the basket pipeline tasks? If I could see what the default basket pipeline tasks did, I would have a better idea of what it was supposed to do. 

    Kind regards,

    Michael.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 04, 2012 @ 13:46
    Søren Spelling Lund
    0

    Hi Michael,

    You can use a tool like dotPeek from Jetbrains to take a look at what the pipeline tasks do.

  • Kieran Harvey 22 posts 55 karma points
    Sep 13, 2012 @ 05:06
    Kieran Harvey
    0

    Søren Spelling Lund::. Do you have any idea when it will be included.

    The way I got around this was to create a pipeline task that calculated tax based off orderlines. You can see how to do this here http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/24826-VAT-Calculation?p=0#comment126662

    and here http://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/12407-Apply-Vat-on-cartaspx-page?p=0

  • Søren Spelling Lund 1797 posts 2786 karma points
    Sep 14, 2012 @ 11:33
    Søren Spelling Lund
    0

    The behavior is fixed in uCommerce 3. All tax calls go through the Service. 

  • João Ferreira 19 posts 40 karma points
    Jul 08, 2013 @ 16:02
    João Ferreira
    0

    Hi Guys, I'm having this same issue. 

    I'm trying to add this logic just to the UCommerce Demo Store, so I'm using the Preview.cshtml file and within the foreach loop I'm trying to re-calculate the VAT on each item depending on which country is selected for shipping. 

    So, my product costs £500 in the UK with 20% VAT applied, I want to apply a different VAT rate if the user requests shipping to another country outside the UK. In my examle I want to apply 0% VAT if the user wants to ship to the USA. I have 2 price groups, GBP 20 and GBP 0 for this.

    At the moment I cannot find a way to get uCommerce to automatically calculate the right VAT rate based on shipping country selected.

    I'm new with ucommerce, so I'm a bit lost with it. The goal is to show the right VAT rate within preview.cshtml.

    I've tried changing this line:

    var itemTax = new Money(lineItem.VAT, currency);

    To:

    var itemTax = taxService.CalculateTax(product, SiteContext.Current.CatalogContext.CurrentCatalog.PriceGroup, itemPrice);

    Notes:

    • taxService is an TaxService Object.
    • product comes from var product = @CatalogLibrary.GetProduct(lineItem.Sku) as it is in the Cart.cshtml

    ... but the result is the same.

    Am I misssing something or do I need to look at changing calculations somewhere else?

    Any assitance would be greatly appreciated!

    Thanks,

    João Ferreira

  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 29, 2013 @ 15:11
    Søren Spelling Lund
    0

    Hi João,

    I believe the two issues are unrelated.

    In your case you probably just need to update the second price group with the same product price as the first one. Otherwise you'll get 0 tax.

Please Sign in or register to post replies

Write your reply to:

Draft