Class TaxMgr

Provides methods to access the tax table.

ConstantDescription
TAX_POLICY_GROSS: Number = 0Constant representing the gross taxation policy.
TAX_POLICY_NET: Number = 1Constant representing the net taxation policy.
PropertyDescription
customRateTaxClassID: String (read-only)Returns the ID of the tax class that represents items with a custom tax rate.
defaultTaxClassID: String (read-only)Returns the ID of the default tax class defined for the site.
defaultTaxJurisdictionID: String (read-only)Returns the ID of the default tax jurisdiction defined for the site.
taxExemptTaxClassID: String (read-only)Returns the ID of the tax class that represents tax exempt items.
taxationPolicy: Number (read-only)Returns the taxation policy (net/gross) configured for the current site.

This class does not have a constructor, so you cannot create it directly.

MethodDescription
static applyExternalTax(Basket)Applies externally set tax rates to the given Basket.
static applyTax(Basket)Applies tax to the given Basket using the platform’s tax hook dispatch logic.
static getCustomRateTaxClassID()Returns the ID of the tax class that represents items with a custom tax rate.
static getDefaultTaxClassID()Returns the ID of the default tax class defined for the site.
static getDefaultTaxJurisdictionID()Returns the ID of the default tax jurisdiction defined for the site.
static getTaxExemptTaxClassID()Returns the ID of the tax class that represents tax exempt items.
static getTaxJurisdictionID(ShippingLocation)Returns the ID of the tax jurisdiction for the specified address.
static getTaxRate(String, String)Returns the tax rate defined for the specified combination of tax class and tax jurisdiction.
static getTaxationPolicy()Returns the taxation policy (net/gross) configured for the current site.

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

TAX_POLICY_GROSS: Number = 0

Constant representing the gross taxation policy.


TAX_POLICY_NET: Number = 1

Constant representing the net taxation policy.


customRateTaxClassID: String (read-only)

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.


defaultTaxClassID: String (read-only)

Returns the ID of the default tax class defined for the site. This class might be used in case a product or service does not define a tax class.

If no default tax class is defined, the method returns null.


defaultTaxJurisdictionID: String (read-only)

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.


taxExemptTaxClassID: String (read-only)

Returns the ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0 for this tax class.

Note that this tax class does not appear in the Business Manager tax module.


taxationPolicy: Number (read-only)

Returns the taxation policy (net/gross) configured for the current site.

See Also:


static applyExternalTax(basket: Basket): void

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:

Parameters:

  • basket - apply external taxation to this basket

static applyTax(basket: Basket): void

Applies tax to the given Basket using the platform's tax hook dispatch logic.

This method is intended for use in custom dw.order.calculate hook implementations (e.g., in SFRA or SiteGenesis) that override the default basket calculation. Calling this method instead of directly invoking dw.order.calculateTax ensures that Commerce App tax providers registered via sfcc.app.tax.calculate are invoked when available, with automatic fallback to the legacy dw.order.calculateTax hook or the platform default tax calculation.

WARNING: Do NOT call this method from within a dw.order.calculateTax hook implementation, as this will cause infinite recursion. This method is designed to be called from dw.order.calculate hooks only.

The dispatch precedence is:

  1. sfcc.app.tax.calculate— if a Commerce App tax provider is installed and the feature is enabled.
  2. dw.order.calculateTax— if registered by the storefront.
  3. Platform default tax calculation — using the site's tax tables.

Typical usage in a custom dw.order.calculate hook:

Parameters:

  • basket - the basket for which tax should be calculated.

static getCustomRateTaxClassID(): String

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.


static getDefaultTaxClassID(): String

Returns the ID of the default tax class defined for the site. This class might be used in case a product or service does not define a tax class.

If no default tax class is defined, the method returns null.

Returns:

  • the ID of the default tax class defined for the site or null.

static getDefaultTaxJurisdictionID(): String

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.

static getTaxExemptTaxClassID(): String

Returns the ID of the tax class that represents tax exempt items. The tax manager will return a tax rate of 0.0 for this tax class.

Note that this tax class does not appear in the Business Manager tax module.


static getTaxJurisdictionID(location: ShippingLocation): String

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.

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.

static getTaxationPolicy(): Number

Returns the taxation policy (net/gross) configured for the current site.

Returns:

  • Taxation policy configured for current site

See Also: