Discount Code Input Methods

SmartCart.applyDiscountvoid

Applies a discount code to the current SmartCart instance.

SmartCart.getApplicableDiscountCodeTotalnumber

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

SmartCart.getDiscountButtonLabelstring

Get the discount button label from the current SmartCart instance

SmartCart.getDiscountCodeLabelstring

Get the discount code label from the current SmartCart instance

SmartCart.getDiscountCodeSettingsobject | null

Get the discount code settings from the current SmartCart instance

SmartCart.getDiscountInvalidMessagestring

Get the discount invalid message from the current SmartCart instance

SmartCart.isDiscountInputEnabledboolean

Determines if the discount code input component is enabled.

SmartCart.removeDiscountvoid

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

SmartCart.shouldApplyDiscountCodeboolean

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

SmartCart.shouldShowDiscountEntitledboolean

Determines if the discount entitled message should be shown.

SmartCart.shouldShowDiscountInputboolean

Determines if the discount input should be shown.

SmartCart.shouldShowDiscountSubtotalboolean

Determines if the discount subtotal should be shown.

SmartCart.showInvalidMessageboolean

Determines if the invalid message should be shown.

SmartCart.useDiscountCodeMessageOnlyboolean

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

SmartCart.applyDiscountvoid

Applies a discount code to the current SmartCart instance.

ParamTypeDescription
discountCodestringThe discount code to apply.
[e]EventThe event object (optional).

SmartCart.getApplicableDiscountCodeTotalnumber

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.getDiscountButtonLabelstring

Get the discount button label from the current SmartCart instance

Returns: string - The discount button text

SmartCart.getDiscountCodeLabelstring

Get the discount code label from the current SmartCart instance

Returns: string - The discount code label text

SmartCart.getDiscountCodeSettingsobject | null

Get the discount code settings from the current SmartCart instance

Returns: object | null - The discount code component settings

SmartCart.getDiscountInvalidMessagestring

Get the discount invalid message from the current SmartCart instance

Returns: string - The discount invalid message text

SmartCart.isDiscountInputEnabledboolean

Determines if the discount code input component is enabled.

SmartCart.removeDiscountvoid

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

SmartCart.shouldApplyDiscountCodeboolean

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.shouldShowDiscountEntitledboolean

Determines if the discount entitled message should be shown.

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

SmartCart.shouldShowDiscountInputboolean

Determines if the discount input should be shown.

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

SmartCart.shouldShowDiscountSubtotalboolean

Determines if the discount subtotal should be shown.

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

SmartCart.showInvalidMessageboolean

Determines if the invalid message should be shown.

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

SmartCart.useDiscountCodeMessageOnlyboolean

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

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