Skip to content

Discount Code Input Methods

SmartCart.applyDiscount ⇒ void

Applies a discount code to the current SmartCart instance.

SmartCart.getApplicableDiscountCodeTotal ⇒ number

Gets the applicable discount amount from a submitted discount code. Used in the Tiered Progress Bar calculations.

SmartCart.getDiscountButtonLabel ⇒ string

Get the discount button label from the current SmartCart instance

SmartCart.getDiscountCodeLabel ⇒ string

Get the discount code label from the current SmartCart instance

SmartCart.getDiscountCodeSettings ⇒ object | null

Get the discount code settings from the current SmartCart instance

SmartCart.getDiscountInvalidMessage ⇒ string

Get the discount invalid message from the current SmartCart instance

SmartCart.isDiscountInputEnabled ⇒ boolean

Determines if the discount code input component is enabled.

SmartCart.removeDiscount ⇒ void

Removes the discount from the current SmartCart instance + local storage.

SmartCart.shouldApplyDiscountCode ⇒ boolean

Determines, based on the presence of an automatic discount, if the discount code should be applied.

SmartCart.shouldShowDiscountEntitled ⇒ boolean

Determines if the discount entitled message should be shown.

SmartCart.shouldShowDiscountInput ⇒ boolean

Determines if the discount input should be shown.

SmartCart.shouldShowDiscountSubtotal ⇒ boolean

Determines if the discount subtotal should be shown.

SmartCart.showInvalidMessage ⇒ boolean

Determines if the invalid message should be shown.

SmartCart.useDiscountCodeMessageOnly ⇒ boolean

Determines if the discount calculation should be omitted (useful for complex discount scenarios).

SmartCart.applyDiscount ⇒ void

Applies a discount code to the current SmartCart instance.

Param Type Description
discountCode string The discount code to apply.
[e] Event The event object (optional).

SmartCart.getApplicableDiscountCodeTotal ⇒ number

Gets the applicable discount amount from a submitted discount code. Used in the Tiered Progress Bar calculations.

Returns: number - The applicable discount amount from the submitted discount code\

SmartCart.getDiscountButtonLabel ⇒ string

Get the discount button label from the current SmartCart instance

Returns: string - The discount button text\

SmartCart.getDiscountCodeLabel ⇒ string

Get the discount code label from the current SmartCart instance

Returns: string - The discount code label text\

SmartCart.getDiscountCodeSettings ⇒ object | null

Get the discount code settings from the current SmartCart instance

Returns: object | null - The discount code component settings\

SmartCart.getDiscountInvalidMessage ⇒ string

Get the discount invalid message from the current SmartCart instance

Returns: string - The discount invalid message text\

SmartCart.isDiscountInputEnabled ⇒ boolean

Determines if the discount code input component is enabled.

SmartCart.removeDiscount ⇒ void

Removes the discount from the current SmartCart instance + local storage.

SmartCart.shouldApplyDiscountCode ⇒ boolean

Determines, based on the presence of an automatic discount, if the discount code should be applied.

Returns: boolean - Whether the discount code should be applied.\

SmartCart.shouldShowDiscountEntitled ⇒ boolean

Determines if the discount entitled message should be shown.

Returns: boolean - Whether the discount entitled message should be shown.\

SmartCart.shouldShowDiscountInput ⇒ boolean

Determines if the discount input should be shown.

Returns: boolean - Whether the discount input should be shown.\

SmartCart.shouldShowDiscountSubtotal ⇒ boolean

Determines if the discount subtotal should be shown.

Returns: boolean - Whether the discount subtotal should be shown.\

SmartCart.showInvalidMessage ⇒ boolean

Determines if the invalid message should be shown.

Returns: boolean - Whether the invalid message should be shown.\

SmartCart.useDiscountCodeMessageOnly ⇒ boolean

Determines if the discount calculation should be omitted (useful for complex discount scenarios).

Returns: boolean - Whether the discount calculation should be omitted until checkout.