SimpleUSTax Component Only Computes Tax when Ship_to_state is Two Characters (196250)



The information in this article applies to:

  • Microsoft Commerce Server 2.0

This article was previously published under Q196250

SYMPTOMS

The SimpleUSTax component in the Purchase pipeline only computes tax when the ship_to_state is two characters. In the Microsoft Wallet form and in many forms, it is not a requirement to use a two character state abbreviation. For example, if Alabama is entered in the state field of the wallet and the SimpleUSTax component specifies AL 6.0%, no tax is charged on the order.

WORKAROUND

To work around the above issue, use a Scriptor component that pre- processes the orderform.ship_to_state before the SimpleUSTax component is run. For example:
  1. Open the Purchase.pcf file in the Pipeline Editor for the store.
  2. Right-click on the SimpleUSTax component, choose to insert the component, and then choose the Scriptor component.
  3. Double-click the Scriptor object and select the Component Properties tab. Change the label to "Pre-processing of ship_to_state."
  4. Click the Scriptor tab and choose Edit.
  5. Copy and paste the following example over the existing script (Note, you can change the states to fit your needs):
          function MSCSExecute(config, orderform, context, flags)
          select case ucase(orderform.ship_to_state)
            case "ALABAMA"
                 orderform.ship_to_state = "AL"
            case "NORTH CAROLINA"
                 orderform.ship_to_state = "NC"
            end select
          MSCSExecute = 1
            end function
    
          sub MSCSOpen(config)
          end sub
    
          sub MSCSClose()
          end sub
    						
  6. Run through the Plan.pcf file by adding items to your basket and totaling the order.
  7. Verify that the state tax is properly computed based on the state that is used.

Modification Type:MajorLast Reviewed:9/30/2003
Keywords:kbprb KB196250