I have come across a situation that presents me with 2 problems.
1. In the state we work, some items are not taxable (Clothing, for example) while other tiems are (Household, for example). We need to be able to identify which category (not necessarily Catalog Category) the items in the LineItem belong to. At first my thoughts were to add a custom property in the Catalog Manager (IsTaxable) and i would be able to find this property inside the pipeline. Form there on it would be fairly easy to accomplish.
2. I can live with the solution above, if i could find a way to get access to the product information, which i cant. Anyone has any ideas on how to get this data OrderForm.LineItems does not provide access to actual Product Info; or at least i cannot see it. On the other hand, this issue is a little more broad as different regions (states) tax different products differently. While we do not tax clothing, neighboring states may. We need to keep track of the items that are taxabl, and where they are taxable.
Would I have to maintain a DB with information on each item I could add another property to the catalog manager indicating which category they belong to. And then lookup the state they are shipped to and determine if they should be taxed. ALthough sounds to me like a bit of a pain to maintain i cant think of another solution.
Luckily for us right now we have presence in 1 state, and can get away with a simpler solution for now. I could do with some help getting product information in the pipeline component. I will worry about the 2nd part later.
Any help, comments or questions are welcomed.
thanks!

Calculate Tax based on Product Information
Ray C
simple scriptor = scriptor component in the pipeline
All of the product properties for each line item are available in the pipeline thanks to the QueryCatalogInfo component mentioned by Colin above. They show up as keys with "_product_" prefixes. For example ProductLine in the catalog would appear as item._product_ProductLine in the pipeline where item is a line item in the order.
We assume the connection string is the same as for the Transactions resource and use the CommerceContext.Current.Resources to get the connection string for the "Transactions" resource. Some manipulation of the string may be necessary depending on how you are accessing the database (SQLClient or OLEdb). The string is then passed into the pipeline in the context dictionary.
The business supplies the state tax information, thankfully. We just code it up.
haber2
hipswich
Rabbi Joseph Gordon
William,
thanks for your input. That is something we have been looking at as an option. A couple of questions about your particular solution:
- What exactly you mean by a simple scriptor
- How are you retrieving the Product information
-Where are you getting the Connection String Do you have it hard coded
- Do you have a resource you can share to find out more information regarding state tax regulations
Beastmen
Asbjørn
I have not had a chance to look deep into your sample but from what i understand you also have a property that determines whether an item is taxable or exempt.
What about the situation described avobe where an item is taxable in California but not taxable in Nevada for example. The property at the product level in the catalog wont be of much help.
Any other ideas
Omar Kalala
Thats what i thought regarding the scriptor. I just wasnt sure.
I looked at the QueryCatalogInfo component and looked at the data dump and could not find my property in there.
Thank you for the information, it is very helpful.
Kardi
Bridel Vinamit
Well, I was able to retrieve my custom property using the QueryCatalogInfo. Even though i had changed the schema and i could see the property in the Catalog Manager, it was not being recognized. Even after recycling the wp for the Catalog Web svc. It only started retrieveing the data once the product was edited. Just loading the catalog again should resolve this issue,
Thank you everyone for your help.
micronax
To determine tax we have had to add a product line property to the product catalog. When we calculate the tax in the pipeline (we use a simple scriptor) we look the product line and region code up in a custom table we have added to the commerce database. If we find them then we calculate tax using a regional tax rate from a second custom table.
A couple of other issues you might run into:
1) Some states tax shipping charges, this can be another entry in the regional tax table
2) Some purchasers may be tax exempt
3) You'll want to calculate the tax as a double and round it after totaling all items for the shipment to avoid rounding errors
Greg Van Mullem
Check out my sample order pipeline component for taxation. I've covered exemption by providing a configurable source identification. That way you can tag an item in the catalog as exempt if needed by creating a catalog property and checking the property that is populated by QueryCatalogInfo (e.g. _product_IsTaxExempt).
To your second point it is the job of QueryCatalogInfo to populate the LineItem with the product information from the catalog. It's non-persisted data, so you won't see it unless you run the QCI component in a pipeline (or choose to persist it by caching the output).
Cheers,
Colin