However, using Merchello Bazaar as the front end, the price still displays with the tax applied on top of the entered tax inclusive price. Eg, price entered as $18 is displayed as $20.70 (GST is 15% in NZ).
Is there something also I need to do to configure this properly?
I note that when checking out, the "total tax" added to the order is $0.00 - so it does appear that it is semi-aware that the tax is already included in the line item pricing.
Trevor - I'd like to see this if you don't mind doing a screen share with me over Skype ... it works without a hitch in every test I've done. Mind if I ping you to set something up?
Firstly a big thanks to Rusty for taking the time to understand my issue (mostly my confusion) and helping come up with a solution.
CONFUSION
Now, my first problem was a misunderstanding of the new features introduced in v.1.10. This feature was to allow the shop admin to enter product pricing "tax exclusive" but have the products rendered on the front end with taxes already applied (tax inclusive). That feature works as stated.
However, in NZ when it comes to consumer to consumer commerce, most shop admins only care about the tax inclusive price and want to enter in the product as $29.95 and have it displayed as $29.95 on the front end. On the resulting invoice however, we want to state that the invoice total "includes tax of $xx.xx".
SOLUTION
Merchello setup:
1. Set your country tax rate provider and leave "include in product pricing" unchecked.
2. Enter all your products with "This variant is taxable" unchecked! (I know it doesn't seem right but trust me).
Now add the following into your App_Code folder (I've named the file TaxesVisitor.cs).
using Merchello.Core;
using Merchello.Core.Gateways.Taxation;
using Merchello.Core.Models;
using Merchello.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core.Logging;
/// <summary>
/// Summary description for TaxesVisitor
/// </summary>
public class TaxesVisitor : ILineItemVisitor
{
private ITaxMethod _taxMethod;
private bool _productPricingEnabled = false;
private IGatewayProviderService _gatewayService = MerchelloContext.Current.Services.GatewayProviderService;
private TaxationGatewayProviderBase _productTaxProvider;
private decimal _taxTotal = 0M;
public decimal TaxTotal { get { return _taxTotal; } }
public TaxesVisitor()
{
initialise();
}
public void Visit(ILineItem lineItem)
{
if (!_productPricingEnabled) return;
var productProvider = _productTaxProvider as ITaxationByProductProvider;
if (lineItem.LineItemType != LineItemType.Product && lineItem.LineItemType != LineItemType.Shipping) return;
if (productProvider != null)
{
var taxMethod = productProvider.GetTaxationByProductMethod(_taxMethod.Key);
var baseTaxRate = taxMethod.TaxMethod.PercentageTaxRate;
var taxRate = baseTaxRate > 1 ? baseTaxRate / 100M : baseTaxRate;
// according to NZ IRD GST laws, you can calc gst one of few ways...you just have to do it consistently!
// I'm going to calc on each line item, calculating the gst on a single unit and rounding and then
// multiple that by the quantity ordered.
// Therefore if the product is $29.95 (incl of 15% gst) then
// GST = 29.95 - ( 29.95 / 1.15 ) = 3.906521 = 3.91
// if I ordered 3 of them, the tax is $11.73.
//
// note, the rounding difference if you calculated GST on the total line item
// 29.95 * 3 = 89.85 - (89.85 / 1.15) = $11.72
_taxTotal += Math.Round(lineItem.Price - (lineItem.Price / (1M + taxRate)), 2) * lineItem.Quantity;
}
}
private void initialise()
{
var taxationContext = MerchelloContext.Current.Gateways.Taxation;
if (!taxationContext.ProductPricingEnabled) return;
_productPricingEnabled = true;
_taxMethod = _gatewayService.GetTaxMethodForProductPricing();
_productTaxProvider = taxationContext.GetProviderByMethodKey(_taxMethod.Key);
}
}
Now in your code that displays the order information (eg if using Merchello Bazaar, InvoiceSummary.cs script) instantiate the taxes visitor and apply it against the Invoice.
var visitor = new TaxesVisitor();
Model.Invoice.Items.Accept(visitor);
At this you can output the tax amount however you like. I've included a new table row after the invoice total that outputs the "includes GST of" amount like this:
I have decided to go with uCommerce for now. The amount of work to adapt it to Nordic circumstances seems to much at the moment. I will look into Merchello for the next Project.
@Marcus - you would need to create a custom tax provider based on product categories. Take a look at the included Flat Rate Tax Provider - I'd think it would be very similar, only you would need to look up the base tax rate per product for the computation.
Many webshops for Business to Consumers (B2C ) in The Netherlands do want to fill in prices vat included in backoffice and want to show the exact same price on the product in the frontend.
In the checkout it needs to say how much tax was calculated.
My question, is the post from Trevor still the way to go? Does it also work for Fasttrack?
In the Merchello 2.4.0 release, a new strategy was included to make this easier.
In the Merchello.config file find strategies and comment out the default InvoiceItemizationStrategy and uncomment the Merchello.Core.Strategies.Itemization.ProductBasedTaxationInvoiceItemazationStrategy line. This will immediately re-itemize things in the back office.
You also have the option of writing your own strategy (just follow the examples above and put the type reference to the custom strategy class in the Merchello.config).
You can use the same strategy on the front end (like the receipt if you need to) but it's not wired into FastTrack at the moment - but I'll add that as a task for the 2.6.0 as it makes sense to do so.
If you wanted to do it quickly in the meantime you could do it right in the view (or override the CheckoutSummaryController).
In the view:
var invoice = MerchelloContext.Current.Services.InvoiceService.GetByKey(model.InvoiceKey);
// there is already an extension to resolve the strategy from IInvoice
var itemization = invoice.ItemizeItems();
return itemization.ToInvoiceItemItemizationDisplay();
Note: adding the strategy to FastTrack in version 2.6.0 will be a minor breaking change in the factory that builds ICheckoutSummaryModel<TBillingAddress, TShippingAddress, TLineItem> if you go the route of overriding the controller ...
The best would be if you could simply put the VAT on the product individually. Otherwise it will always be a case of using extended data for non US-countries.
Simply because many Countries use differentiated VAT based on product types. For instance Books here have 6% VAT, Food 12% and rest 25%.
The VAT value and product price does get put into the ExtendedData collection of the product line item.
On the road map for Merchello 2.6.0 is a new taxation provider to handle taxation for various tax categories. It'd be great if you would write up your thoughts in the discussion. http://issues.merchello.com/youtrack/issue/M-1294
Hi Rusty, do you have any idea when will Merchello 2.6.0 be available? i am going to start a new project and would like to start with this version. Will it work with Umbraco v7.6?
We are really just getting started on 2.6.0 - I've been on holiday and busy just getting organized/planning - and don't have an estimated time table as of yet.
I did but maybe not that issue ;). Forgot where I put it.
Essentially I would like more configurations for individual products when it comes to VAT. Similar to how uCommerce does it if you need inspiration :).
Taxes included in product prices
Hi,
Since v1.10 you can set up Merchello to allow the store owner to input tax inclusive prices against a product.
To set it up
However, using Merchello Bazaar as the front end, the price still displays with the tax applied on top of the entered tax inclusive price. Eg, price entered as $18 is displayed as $20.70 (GST is 15% in NZ).
Is there something also I need to do to configure this properly?
I note that when checking out, the "total tax" added to the order is $0.00 - so it does appear that it is semi-aware that the tax is already included in the line item pricing.
Any help, much appreciated. Cheers, Trevor
Trevor - I'd like to see this if you don't mind doing a screen share with me over Skype ... it works without a hitch in every test I've done. Mind if I ping you to set something up?
FIXED!
Firstly a big thanks to Rusty for taking the time to understand my issue (mostly my confusion) and helping come up with a solution.
CONFUSION
Now, my first problem was a misunderstanding of the new features introduced in v.1.10. This feature was to allow the shop admin to enter product pricing "tax exclusive" but have the products rendered on the front end with taxes already applied (tax inclusive). That feature works as stated.
However, in NZ when it comes to consumer to consumer commerce, most shop admins only care about the tax inclusive price and want to enter in the product as $29.95 and have it displayed as $29.95 on the front end. On the resulting invoice however, we want to state that the invoice total "includes tax of $xx.xx".
SOLUTION
Merchello setup: 1. Set your country tax rate provider and leave "include in product pricing" unchecked. 2. Enter all your products with "This variant is taxable" unchecked! (I know it doesn't seem right but trust me).
Now add the following into your App_Code folder (I've named the file TaxesVisitor.cs).
Now in your code that displays the order information (eg if using Merchello Bazaar, InvoiceSummary.cs script) instantiate the taxes visitor and apply it against the Invoice.
At this you can output the tax amount however you like. I've included a new table row after the invoice total that outputs the "includes GST of" amount like this:
And voila! There you have everything calculating correctly for tax inclusive pricing.
Thanks - this helped me a lot!!!
I tryed this and it woks great in the cart. But in the order confirnation mail and in the backoffice the tax is still 0.
I'm using the latest Merchello 1.13.0.
What do I have to do to get it to update these too?
How would you go about putting variable taxes on products? That is something I can't get my head around.
Eg. Some Products have 25% VAT, some 6% etc. How?
Hi Marcus,
Any update on this?
I have decided to go with uCommerce for now. The amount of work to adapt it to Nordic circumstances seems to much at the moment. I will look into Merchello for the next Project.
@Marcus - you would need to create a custom tax provider based on product categories. Take a look at the included Flat Rate Tax Provider - I'd think it would be very similar, only you would need to look up the base tax rate per product for the computation.
I thought about that but I couldn't find any docs on how to create providers.
Hi,
I do have exactly the same issue.
Many webshops for Business to Consumers (B2C ) in The Netherlands do want to fill in prices vat included in backoffice and want to show the exact same price on the product in the frontend. In the checkout it needs to say how much tax was calculated.
My question, is the post from Trevor still the way to go? Does it also work for Fasttrack?
Any info would be great!
Cheers, Arjan
In the Merchello 2.4.0 release, a new strategy was included to make this easier.
In the
Merchello.config
file find strategies and comment out the defaultInvoiceItemizationStrategy
and uncomment theMerchello.Core.Strategies.Itemization.ProductBasedTaxationInvoiceItemazationStrategy
line. This will immediately re-itemize things in the back office.The code for the actual strategy is here: https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Core/Strategies/Itemization/ProductBasedTaxationInvoiceItemazationStrategy.cs#L8
It uses an visitor class to itemize the invoice. That can be found here: https://github.com/Merchello/Merchello/blob/merchello-dev/src/Merchello.Core/Strategies/Itemization/ProductBasedTaxationVisitor.cs#L11
You also have the option of writing your own strategy (just follow the examples above and put the type reference to the custom strategy class in the Merchello.config).
You can use the same strategy on the front end (like the receipt if you need to) but it's not wired into FastTrack at the moment - but I'll add that as a task for the 2.6.0 as it makes sense to do so.
If you wanted to do it quickly in the meantime you could do it right in the view (or override the
CheckoutSummaryController
).In the view:
Note: adding the strategy to FastTrack in version 2.6.0 will be a minor breaking change in the factory that builds
ICheckoutSummaryModel<TBillingAddress, TShippingAddress, TLineItem>
if you go the route of overriding the controller ...Hi Rusty,
Thank you for the extensive answer. This week I'll look into this. Hopefully I'll figure it all out ;)
Thanks for helping!
The best would be if you could simply put the VAT on the product individually. Otherwise it will always be a case of using extended data for non US-countries.
Simply because many Countries use differentiated VAT based on product types. For instance Books here have 6% VAT, Food 12% and rest 25%.
The VAT value and product price does get put into the ExtendedData collection of the product line item.
On the road map for Merchello 2.6.0 is a new taxation provider to handle taxation for various tax categories. It'd be great if you would write up your thoughts in the discussion. http://issues.merchello.com/youtrack/issue/M-1294
Posted my 2 cents on the issue tracker :)
Essentially the same issue I have.
Hi Rusty, do you have any idea when will Merchello 2.6.0 be available? i am going to start a new project and would like to start with this version. Will it work with Umbraco v7.6?
We are really just getting started on 2.6.0 - I've been on holiday and busy just getting organized/planning - and don't have an estimated time table as of yet.
It will definitely work with 7.6 =)
I did but maybe not that issue ;). Forgot where I put it.
Essentially I would like more configurations for individual products when it comes to VAT. Similar to how uCommerce does it if you need inspiration :).
is working on a reply...