Discount Ninja
Search
K

discountNinjaContext object

Documentation regarding the context object provided by Discount Ninja.
This page is under construction
This object is used by Discount Ninja widgets and components. It is not part of the Public API and third-party developers should therefore not rely on it. The information provided here is for information only.
The discountNinjaContext JavaScript object is available in the global scope.

Properties available on all pages

DesignMode (boolean)
Shop (string)
RootRoute
CartRoute
Cart
CollectionProducts ([CollectionProduct])
CartProducts ([CartProduct])
ProductVariants ([ProductVariant])
Promotion

Properties configured in the settings of the app

Settings
  • MoneyFormatting
    • ProductPage (MoneyFormattingForLocation)
    • ProductPageSoldOut (MoneyFormattingForLocation)
    • ProductPageDiscounted (MoneyFormattingForLocation)
    • Collection (MoneyFormattingForLocation)
    • CollectionSoldOut (MoneyFormattingForLocation)
    • CollectionDiscounted (MoneyFormattingForLocation)
    • DrawerCartProduct (MoneyFormattingForLocation)
    • DrawerCartLine (MoneyFormattingForLocation)
    • DrawerCartSubtotal (MoneyFormattingForLocation)
    • DrawerCartDiscount (MoneyFormattingForLocation)
    • DrawerCartShipping (MoneyFormattingForLocation)
    • DrawerCartTaxes (MoneyFormattingForLocation)
    • DrawerCartTotal (MoneyFormattingForLocation)
    • CartProduct (MoneyFormattingForLocation)
    • CartLine (MoneyFormattingForLocation)
    • CartSubtotal (MoneyFormattingForLocation)
    • CartDiscount (MoneyFormattingForLocation)
    • CartShipping (MoneyFormattingForLocation)
    • CartTaxes (MoneyFormattingForLocation)
    • CartTotal (MoneyFormattingForLocation)
The MoneyFormattingForLocation type specifies the following properties:
  • NotDiscounted (MoneyFormattingForLocationAndType)
  • SoldOut (MoneyFormattingForLocationAndType): only applicable for collection and product page prices
  • Discounted (MoneyFormattingForLocationAndType)
The MoneyFormattingForLocationAndType type specifies the following properties:
  • Layout (string)
  • HeaderTemplate (string)
  • PriceTemplate (string) [required]
  • CompareAtPriceTemplate (string)
  • UnitPriceTemplate (string)
  • MsrpTemplate (string)
  • ComplianceTemplate (string)
  • FooterTemplate (string)
  • IncludeCurrencyCode ("never" | "always" | "non-default")
  • IncludeCurrencySymbol ("never" | "always" | "non-default")
  • IncludeTrailingZeros (boolean)
  • Precision (0 | 1 | 2)
  • ZeroIsFree (boolean)
  • CentsSuperscript (boolean)
  • HideDecimalSeparator (boolean)
The Layout and Templates fields match the attributes of the Price widget. The remaining fields match the attributes of the Money component.

Properties used for authentication with APIs

Status (string)
Signature (string)

Properties used for localization

Country
  • ISOCode
  • Name
ShopCurrency
PresentmentCurrency
PresentmentCurrencyMoney
MoneyFormat
Locale
Labels
  • From
  • Here
  • Free
  • Soldout
  • UnitPriceSeparator
  • Accessibility
    • Price
    • DiscountedPrice
    • OriginalPrice
    • MSRP
    • UnitPrice
    • UnitPer
    • CompliancePrice
    • UnitPriceSeparator

Properties available when logged in

Customer
  • Id
  • NumberOfOrders
  • Email
  • Tags
  • FirstName
  • LastName

Properties available when on a product page

Product

Properties used for advanced settings

These settings are configured in the app
Flags