Displaying tax as part of the product price

The Tax Categories pages in WebSphere Commerce Accelerator allow you to select an option to include the tax in the product price. Taxes can be displayed for only one tax jurisdiction. In order to display the tax on your product pages (or any page where you display the price), you must ensure that your store profile is set to match the jurisdiction for which you want to display taxes. For example, if you want to display taxes for Jurisdiction 'Canada' then the store profile must also be set to 'Canada'.

About this task

Displaying taxes as part of the product price involves:
  • Store profile settings
  • Setting up taxes
  • Modifying JSP pages

Procedure

  1. Ensure that the store profile for the store that you are using is set to the correct jurisdiction.
    1. Open the WebSphere Commerce Accelerator.
    2. From the Store menu, select Change Profile.
    3. The Store Profile notebook opens. If you do not see this menu, then your logon ID does not have the appropriate authority to perform this task. Contact your Site Administrator.
    4. From the left navigation frame, click Contact. Ensure that the address information for the store corresponds to the jurisdiction for which you want to display taxes.
    5. From the left navigation frame, click Location. Ensure that the address information for the store corresponds to the jurisdiction for which you want to display taxes.
  2. Setting up taxes:
    1. Ensure that you have set up taxes to correspond to the jurisdiction for which you want to display taxes. See setting up taxes.
    2. Ensure that the Tax Category is set up with the 'Include tax in display price' check box selected.
  3. Modifying JSP pages:
    Modify the following JSP pages to include the sample code provided.
    Note: If you substitute totalCategorizedValue for categoryAmount in the pieces of sample code below, the total categorized tax amount will be displayed instead of the tax amount from the first category.
    1. WebSphere Commerce Enterprise Navigate to WC_eardir/Stores.war/ConsumerDirect/Snippets/Catalog/CatalogEntryDisplay/
    2. Open the CachedItemDisplay.jsp in a text editor and add the following sample code:
      
      <%-- Start: sample code for item price with tax --%>
      <fmt:formatNumber
      value="${item.applicableContractPrices[i].primaryPrice.value}" 
              var="oldPrice"/>
      <fmt:formatNumber value="${item.displayTaxes.categoryAmount}"
      var="taxAmount"/>
      <c:set var="totalPriceWithTax" value="${oldPrice +
      taxAmount}"/>
      <td class="price"
      id="WC_CachedItemDisplay_TableCell_12a_<c:out
      value="${i}"/>">
              <fmt:formatNumber value="${totalPriceWithTax}"
      type="currency" 
              currencyCode="${CommandContext.currency}"/></td>
      <%-- End: sample code for item price with tax --%>
      
    3. Navigate to the following directory:
      • WebSphere Commerce EnterpriseWebSphere Commerce - ExpressWebSphere Commerce Professional WC_eardir/Stores.war/ConsumerDirect/Snippets/Catalog/CatalogEntryDisplay/
      • WebSphere Commerce - ExpressWebSphere Commerce ProfessionalWC_eardir/Stores.war/ConsumerDirect/Snippets/Catalog/CatalogEntryDisplay/
    4. Open the CachedProductOnlyDisplay.jsp in a text editor and add the following sample code:
      
      <%-- Start: sample code for item price with tax --%>
      <fmt:formatNumber
      value="${product.calculatedContractPrice.primaryPrice.value}"
               var="oldPrice"/>
      <fmt:formatNumber value="${product.displayTaxes.categoryAmount}"
      var="taxAmount"/>
      <c:set var="totalPriceWithTax" value="${oldPrice +
      taxAmount}"/>
      <br/>
      Price with tax: 
      <span class="price">
      <fmt:formatNumber value="${totalPriceWithTax}" type="currency" 
              currencyCode="${CommandContext.currency}"/>
      </span>
      <br/>
      <span class="text">
      <c:out value="${product.description.longDescription}"
      escapeXml="false" />
      </span>
      <br/>
      <%-- End: sample code for item price with tax --%>