Returns the ID of the tax class that represents items with a custom tax rate. The standard order calculation
process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate
lookup sequence of the calculation process.
Note that this tax class does not appear in the Business Manager tax module.
Returns the ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no
jurisdiction is defined for a specific address.
If no default tax jurisdiction is defined, this method returns null.
Applies externally set tax rates to the given Basket. Only use when
LineItemCtnr.isExternallyTaxed() returns true. Note: a basket can only be created in EXTERNAL
tax mode using SCAPI.
Typical usage in tax calculation:
1var TaxMgr = require('dw/order/TaxMgr');23 calculateTaxes: function () {4 Basket basket = BasketMgr.getCurrentBasket();5 if ( basket.isExternallyTaxed() )6 {7 TaxMgr.applyExternalTaxation( basket );8 }9 else10 {11 // calculation with tax tables or customization12 }13 }
Applies tax to the given Basket using the platform's tax hook dispatch logic.
This method is intended for use in custom {@code dw.order.calculate} hook implementations (e.g., in SFRA or
SiteGenesis) that override the default basket calculation. Calling this method instead of directly invoking
{@code dw.order.calculateTax} ensures that Commerce App tax providers registered via
{@code sfcc.app.tax.calculate} are invoked when available, with automatic fallback to the legacy
{@code dw.order.calculateTax} hook or the platform default tax calculation.
WARNING: Do NOT call this method from within a {@code dw.order.calculateTax} hook
implementation, as this will cause infinite recursion. This method is designed to be called from
{@code dw.order.calculate} hooks only.
The dispatch precedence is:
{@code sfcc.app.tax.calculate}— if a Commerce App tax provider is installed and the feature is enabled.
{@code dw.order.calculateTax}— if registered by the storefront.
Platform default tax calculation — using the site's tax tables.
Typical usage in a custom {@code dw.order.calculate} hook:
Returns the ID of the tax class that represents items with a custom tax rate. The standard order calculation
process assumes that such line items are initialized with a tax rate and a being ignored during the tax rate
lookup sequence of the calculation process.
Note that this tax class does not appear in the Business Manager tax module.
Returns the ID of the default tax jurisdiction defined for the site. This jurisdiction might be used in case no
jurisdiction is defined for a specific address.
If no default tax jurisdiction is defined, this method returns null.
Returns:
the ID of the default tax jurisdiction defined for the site or null.
Returns the ID of the tax jurisdiction for the specified address. If no tax jurisdiction defined for the site
matches the specified address, this method returns null.
Parameters:
location - The shipping location
Returns:
the ID of the tax jurisdiction for the specified address or null.
getTaxRate(String, String)
static getTaxRate(taxClassID: String, taxJurisdictionID: String): Number
Returns the tax rate defined for the specified combination of tax class and tax jurisdiction.
Method returns null if no tax rate is defined.
Method returns 0.0 of 'nontaxable' tax rate is specified (see method 'getNontaxableTaxClassID'.
Parameters:
taxClassID - ID of the tax class
taxJurisdictionID - ID of tax jusrisdiction
Returns:
the tax rate defined for the specified combination of tax class and tax jurisdiction.