All methods below are as if the Smart Cart object has a reference variable defined as shown in this code snippet.

const SmartCart = window.Rebuy.SmartCart;

This is not a complete list of the globally available function but the ones that we find most helpful.

Overview


getAnnouncementBarsInCartArray

Get announcement bar instances used in the cart

getAnnouncementsByComponentIdArray

Get announcements by component ID

itemIsBundleboolean

Check whether item is a bundle product

itemBundleLengthboolean

Check if item is bundle and has more than 1 option

childBundleTitlestring

Remove extra word from bundle option title

isBundleVisibleboolean

Check whether the item is the currently expanded bundle

toggleActiveBundlevoid

Toggle the active product bundle

getBundleOptionImagestring

Get the bundle option image

itemHasBMSMboolean | void

Checks if the provided item has Buy More Save More (BMSM) discount enabled.

hasBMSMButtonsboolean

Checks if the BMSM discount is displayed as buttons.

getBMSMTiersArray

Gets the BMSM tiers.

getBMSMButtonTextstring

Gets the BMSM discount button text for the provided tier.

adjustBMSMQuantityvoid

Adjusts the BMSM quantity for the provided item and tier.

buyMoreSaveMoreDynamicTextstring | void

Gets the dynamic BMSM discount text for the provided item.

bMSMFinalTierNotReachedboolean

Checks if the final BMSM tier has been reached for the provided item.

getCheckoutSettingsobject

gets the checkout settings from the SmartCart

hasTermsEnabledboolean

Determines if the terms and conditions are enabled in settings

hasAcceptedTermsboolean

Checks if the user has accepted the terms and conditions

updateTermsCheckvoid

Update the terms checkbox status

hasCheckoutButtonboolean

Checks if the checkout button is enabled

checkoutvoid

Performs the checkout process

shopPayCheckoutvoid

Performs the Shop Pay checkout process

shopPaySvg : string

SVG code for the Shop Pay icon.

checkoutLabelstring

Gets the label for the checkout button

hasViewCartButtonboolean

Checks if the View Cart button is enabled

viewCartvoid

Navigates to the Shopify Cart Page

viewCartLabelstring

Gets the label for the View Cart button

hasContinueShoppingButtonboolean

Checks if the Continue Shopping button is enabled

continueShoppingLabelstring

Get the label for the Continue Shopping button

hasShopPayButtonboolean

Checks if the Shop Pay button is enabled

installmentsEnabledboolean

Returns true if the payment installments indicator text is enabled

installmentsMessagestring

Returns the payment installments indicator text

hasPrePurchaseboolean

Returns true if there is a pre-purchase pop-up widget enabled

prePurchaseWidgetIdstring

Returns the pre-purchase pop-up widget ID

getAdditionalCheckoutButtonsboolean | Array.<Element>

Checks for the existence of the '.additional-checkout-buttons' element, which is used by the 'rebuy-smartcart-extensions.liquid' snippet

appendAcceleratedCheckoutvoid

Appends the '.additional-checkout-buttons' element to the SmartCart flyout

getPreviewButtonsElement

Returns the Accelerated Checkout buttons for previewing in the Admin

adjustPreviewButtonsvoid

Updates the Accelerated Checkout buttons for previewing in the Admin.

clearAcceleratedCheckoutvoid

Removes the '.additional-checkout-buttons' element from the SmartCart flyout

renderPayPalButtonvoid

Conditionally renders a paypal button if the PayPal iFrame is not rendered

manageAcceleratedCheckoutvoid

Manages the Accelerated Checkout feature

getAllCrossSellWidgetIdsArray.<string>

Get all cross sell widget IDs in Cross-Sell components in the current Smart Cart settings

hasCrossSellWidgetsboolean

Check if there are cross sell widgets in the current Smart Cart settings

getWidgetIdByComponentIdstring | null

Get the widget ID by component ID

executeCustomCodevoid

Executes the custom code -- in case there is any JS that needs to be executed

injectCustomCodeBlocksvoid

Injects the custom code HTML into the DOM

getDiscountCodeSettingsobject | null

Get the discount code settings from the current SmartCart instance

getDiscountCodeLabelstring

Get the discount code label from the current SmartCart instance

getDiscountButtonLabelstring

Get the discount button label from the current SmartCart instance

getDiscountInvalidMessagestring

Get the discount invalid message from the current SmartCart instance

applyDiscountvoid

Applies a discount code to the current SmartCart instance.

showInvalidMessageboolean

Determines if the invalid message should be shown.

shouldShowDiscountEntitledboolean

Determines if the discount entitled message should be shown.

shouldShowDiscountInputboolean

Determines if the discount input should be shown.

shouldShowDiscountSubtotalboolean

Determines if the discount subtotal should be shown.

shouldApplyDiscountCodeboolean

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

useDiscountCodeMessageOnlyboolean

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

removeDiscountvoid

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

isDiscountInputEnabledboolean

Determines if the discount code input component is enabled.

getLoginLabelstring

Get the login button text from the current SmartCart instance

getLoginUrlstring

Get the login button URL from the current SmartCart instance

shouldRenderLoginComponentboolean

Check if the login component should be rendered

getNotesSettingsobject

Returns the notes settings from the SmartCart object.

getNotesDataobject | null

Returns the notes state data from the SmartCart object (not the settings).

getNotesLabelstring

Returns the configured label for the notes input

getNotesPlaceholderstring

Returns the configured placeholder for the notes input

notesEnabledboolean

Returns a boolean indicating whether or not the notes component is enabled (ie. not hidden)

notesIsVisibleboolean

Returns a boolean indicating whether or not the notes input is visible to customer

notesTogglevoid

Handles toggling the visibility of the notes input

notesChangevoid

Handles updating the notes value

notesRemainingCharactersstring

Returns a string containing the remaining characters message

isEnabledboolean

Determine if the SwitchToSubscription functionality is enabled + available

hasSwitchToSubscriptionboolean

Determine if the item has the SwitchToSubscription functionality

subscriptionDowngradeDisabledboolean

Determine if the SmartCart subscription downgrade functionality is disabled

getLabelstring

Get the SwitchToSubscription label string

switchToSubscriptionLabelstring

Get the SwitchToSubscription label string for the item

subscriptionOptionGroupLabelstring

Get the SwitchToSubscription subscription option group label string

subscriptionOptionLabelstring | number | void

Get the SwitchToSubscription subscription option label string

getSettings()object

Get the settings for the SwitchToSubscription functionality

getBarForLocationobject

Get progress bar settings based on location

isProgressBarEnabledboolean

Determine if the progress bar is enabled

getProgressBarSettingsobject

Get the progress bar settings object

hasProgressPromptboolean | string

Determine if the progress bar has a prompt for the current tier

getTierCompletedTextstring

Get the text for the completed tier

getTierFeedbackTextstring

Get the text for the current tier (either in progress or completed)

getCurrentTierobject | null

Gets current tier

getTierMinimumnumber | null

Gets the minimum threshold for a given tier

getTierLabelstring

Gets the label for a given tier

progressStepMaxWidthstring

Utility helper for getting the max width of the tiers for CSS

progressTierIconstring

Utility helper for getting the icon for a given tier

tierProgressIconstring

Utility helper for getting the icon for a given tier (In Progress)

tierCompleteIconstring

Utility helper for getting the icon for a given tier (Complete)

hasTierProgressboolean

Determine if there is any progress to show in the progress bar

hasFreeShippingOnSubscriptionboolean

Determine if Free Shipping should be satisfied by a subscription product in the Cart

calculatePercentageWithSubscriptionProductnumber

Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied

calculatePercentageWithNormalTierMinimumsnumber

Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied

tiersPercentageCompletestring | number

Calculates the progress bar's percentage completed

progressTierReachedboolean

Determines if the tier has been reached based on the subtotal

getSpendToNextTiernumber

Gets the difference between the subtotal and the next tier's minimum

getEarnedProductsArray

Gets the list of earned products from the bar

freeProductPromptstring | void

Gets text for the Free Product button - based on the product's status

freeProductStylesobject | void

Gets the product's background image / styles

freeProductTileStyleobject | void

Gets the product's tile width, based on the number of earned products

getFreeVariantTitlestring

Gets the product's title, if it's not the default title

removeAllFreeGiftsvoid

Removes all cart products with the _attribution property set to ITEM_ATTRIBUTION.TIERED_PROGRESS_BAR

updateFreeProductsvoid

Updates the free products in the cart based on the current subtotal. This contains the primary logic for the progress bar cart management

selectFreeProductVariant

Handles the selection of a free gift variant in the bar

freeProductOptionsArray

Gets the options for a free gift product - either all variants or selected variants

addFreeProductvoid

Adds a free gift to the cart

removeFreeProductvoid

Removes a free product from the cart + updates the declined gifts cookie

getTieredBarProductDataobject

Checks local storage for cached product data, and fetches any missing product data from the API

getAnnouncementBarsInCart

Get announcement bar instances used in the cart

Kind: global constant
Returns: Array - The announcement bar instances

getAnnouncementsByComponentId

Get announcements by component ID

Kind: global constant
Returns: Array - The announcements for the component

ParamTypeDescription
idstringThe component ID

itemIsBundle

Check whether item is a bundle product

Kind: global constant
Returns: boolean - true if item is bundle

ParamTypeDescription
itemobjectline item

itemBundleLength

Check if item is bundle and has more than 1 option

Kind: global constant
Returns: boolean - true if item is bundle and has more than 1 option

ParamTypeDescription
itemobjectline item

childBundleTitle

Remove extra word from bundle option title

Kind: global constant
Returns: string - bundle option title

ParamTypeDescription
optionobjectbundle option

isBundleVisible

Check whether the item is the currently expanded bundle

Kind: global constant
Returns: boolean - true if the item is the currently expanded bundle

ParamTypeDescription
itemobjectline item

toggleActiveBundle

Toggle the active product bundle

Kind: global constant

ParamTypeDescription
itemobjectline item

getBundleOptionImage

Get the bundle option image

Kind: global constant
Returns: string - Image URL

ParamTypeDescription
productobjectProduct object
currentOptionobjectCurrent option
currentOptionIndexnumberIndex of the current option

itemHasBMSM

Checks if the provided item has Buy More Save More (BMSM) discount enabled.

Kind: global constant
Returns: boolean | void - True if the item has BMSM discount enabled, false otherwise.

ParamTypeDescription
itemobjectThe item to check for BMSM discount.

hasBMSMButtons

Checks if the BMSM discount is displayed as buttons.

Kind: global constant
Returns: boolean - - True if the BMSM discount is displayed as buttons, false otherwise.

getBMSMTiers

Gets the BMSM tiers.

Kind: global constant
Returns: Array - - An array of BMSM discount tiers.

getBMSMButtonText

Gets the BMSM discount button text for the provided tier.

Kind: global constant
Returns: string - - The BMSM discount button text for the provided tier.

ParamTypeDescription
tierobjectThe BMSM tier for which to get the button text.

adjustBMSMQuantity

Adjusts the BMSM quantity for the provided item and tier.

Kind: global constant

ParamTypeDescription
itemobjectThe item for which to adjust the BMSM quantity.
tierobjectThe BMSM tier for which to adjust the quantity.

buyMoreSaveMoreDynamicText

Gets the dynamic BMSM discount text for the provided item.

Kind: global constant
Returns: string | void - The dynamic BMSM discount text for the provided item.

ParamTypeDescription
itemobjectThe item for which to get the dynamic BMSM discount text.

bMSMFinalTierNotReached

Checks if the final BMSM tier has been reached for the provided item.

Kind: global constant
Returns: boolean - - True if the final BMSM tier has not been reached, false otherwise.

ParamTypeDescription
itemobjectThe item for which to check if the final BMSM tier has been reached.

getCheckoutSettings

gets the checkout settings from the SmartCart

Kind: global constant
Returns: object - - The checkout settings object

hasTermsEnabled

Determines if the terms and conditions are enabled in settings

Kind: global constant
Returns: boolean - - True if terms and conditions are enabled, otherwise false

hasAcceptedTerms

Checks if the user has accepted the terms and conditions

Kind: global constant
Returns: boolean - - True if the user has accepted the terms, otherwise false

updateTermsCheck

Update the terms checkbox status

Kind: global constant

hasCheckoutButton

Checks if the checkout button is enabled

Kind: global constant
Returns: boolean - - True if the checkout button is enabled, otherwise false

checkout

Performs the checkout process

Kind: global constant

shopPayCheckout

Performs the Shop Pay checkout process

Kind: global constant

shopPaySvg

SVG code for the Shop Pay icon.

Kind: global constant

checkoutLabel

Gets the label for the checkout button

Kind: global constant
Returns: string - - The label for the checkout button (HTML content)

hasViewCartButton

Checks if the View Cart button is enabled

Kind: global constant
Returns: boolean - - True if the View Cart button is enabled, otherwise false

viewCart

Navigates to the Shopify Cart Page

Kind: global constant

viewCartLabel

Gets the label for the View Cart button

Kind: global constant
Returns: string - - The label for the View Cart button

hasContinueShoppingButton

Checks if the Continue Shopping button is enabled

Kind: global constant
Returns: boolean - - True if the Continue Shopping button is enabled, otherwise false

continueShoppingLabel

Get the label for the Continue Shopping button

Kind: global constant
Returns: string - - The label for the Continue Shopping button

hasShopPayButton

Checks if the Shop Pay button is enabled

Kind: global constant
Returns: boolean - - True if the Shop Pay button is enabled, otherwise false

installmentsEnabled

Returns true if the payment installments indicator text is enabled

Kind: global constant

installmentsMessage

Returns the payment installments indicator text

Kind: global constant
Returns: string - HTML

hasPrePurchase

Returns true if there is a pre-purchase pop-up widget enabled

Kind: global constant

prePurchaseWidgetId

Returns the pre-purchase pop-up widget ID

Kind: global constant

getAdditionalCheckoutButtons

Checks for the existence of the '.additional-checkout-buttons' element, which is used by the 'rebuy-smartcart-extensions.liquid' snippet

Kind: global constant

ParamTypeDescription
parentElementDOM Element

appendAcceleratedCheckout

Appends the '.additional-checkout-buttons' element to the SmartCart flyout

Kind: global constant

getPreviewButtons

Returns the Accelerated Checkout buttons for previewing in the Admin

Kind: global constant

ParamTypeDescription
settingsobjectSmart Cart Settings

adjustPreviewButtons

Updates the Accelerated Checkout buttons for previewing in the Admin.

Kind: global constant

ParamTypeDescription
settingsobjectSmart Cart settings

clearAcceleratedCheckout

Removes the '.additional-checkout-buttons' element from the SmartCart flyout

Kind: global constant

renderPayPalButton

Conditionally renders a paypal button if the PayPal iFrame is not rendered

Kind: global constant

manageAcceleratedCheckout

Manages the Accelerated Checkout feature

Kind: global constant

getAllCrossSellWidgetIds

Get all cross sell widget IDs in Cross-Sell components in the current Smart Cart settings

Kind: global constant
Returns: Array. - Array of widget IDs

hasCrossSellWidgets

Check if there are cross sell widgets in the current Smart Cart settings

Kind: global constant
Returns: boolean - True if there are cross sell widgets

getWidgetIdByComponentId

Get the widget ID by component ID

Kind: global constant
Returns: string | null - The widget ID

ParamTypeDescription
componentIdstringThe component ID

executeCustomCode

Executes the custom code -- in case there is any JS that needs to be executed

Kind: global constant

injectCustomCodeBlocks

Injects the custom code HTML into the DOM

Kind: global constant

getDiscountCodeSettings

Get the discount code settings from the current SmartCart instance

Kind: global constant
Returns: object | null - The discount code component settings

getDiscountCodeLabel

Get the discount code label from the current SmartCart instance

Kind: global constant
Returns: string - The discount code label text

getDiscountButtonLabel

Get the discount button label from the current SmartCart instance

Kind: global constant
Returns: string - The discount button text

getDiscountInvalidMessage

Get the discount invalid message from the current SmartCart instance

Kind: global constant
Returns: string - The discount invalid message text

applyDiscount

Applies a discount code to the current SmartCart instance.

Kind: global constant

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

showInvalidMessage

Determines if the invalid message should be shown.

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

shouldShowDiscountEntitled

Determines if the discount entitled message should be shown.

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

shouldShowDiscountInput

Determines if the discount input should be shown.

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

shouldShowDiscountSubtotal

Determines if the discount subtotal should be shown.

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

shouldApplyDiscountCode

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

Kind: global constant
Returns: boolean - Whether the discount code should be applied.

useDiscountCodeMessageOnly

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

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

removeDiscount

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

Kind: global constant

isDiscountInputEnabled

Determines if the discount code input component is enabled.

Kind: global constant

getLoginLabel

Get the login button text from the current SmartCart instance

Kind: global constant
Returns: string - The login button text

getLoginUrl

Get the login button URL from the current SmartCart instance

Kind: global constant
Returns: string - The login button URL

shouldRenderLoginComponent

Check if the login component should be rendered

Kind: global constant
Returns: boolean - True if the login component should be rendered

getNotesSettings

Returns the notes settings from the SmartCart object.

Kind: global constant

getNotesData

Returns the notes state data from the SmartCart object (not the settings).

Kind: global constant

getNotesLabel

Returns the configured label for the notes input

Kind: global constant

getNotesPlaceholder

Returns the configured placeholder for the notes input

Kind: global constant

notesEnabled

Returns a boolean indicating whether or not the notes component is enabled (ie. not hidden)

Kind: global constant

notesIsVisible

Returns a boolean indicating whether or not the notes input is visible to customer

Kind: global constant

notesToggle

Handles toggling the visibility of the notes input

Kind: global constant

notesChange

Handles updating the notes value

Kind: global constant

ParamTypeDescription
eventEventDOM user action event

notesRemainingCharacters

Returns a string containing the remaining characters message

Kind: global constant

executeApps

Executes the app scripts

Kind: global constant

injectAppScripts

Injects the app scripts into the DOM

Kind: global constant

ParamTypeDescription
cartSettingsobjectSmart Cart settings

enrichApps

Hydrates apps with data from API

Kind: global constant

ParamTypeDescription
cartSettingsobjectSmart Cart settings

getSubtotalSettings

Returns the subtotal settings from the SmartCart components array.

Kind: global constant

subtotalLabel

Returns the subtotal label.

Kind: global constant

subtotal

Returns the subtotal amount to display. The subtotal is often just a formatted string, but can be returned as HTML to display a compare (discount) price

Kind: global constant

ParamTypeDescription
formatstringCurrency format string

isEnabled

Determine if the SwitchToSubscription functionality is enabled + available

Kind: global constant
Returns: boolean - response

hasSwitchToSubscription

Determine if the item has the SwitchToSubscription functionality

Kind: global constant
Returns: boolean - response

ParamTypeDescription
itemobjectrebuy cart item

subscriptionDowngradeDisabled

Determine if the SmartCart subscription downgrade functionality is disabled

Kind: global constant
Returns: boolean - response

getLabel

Get the SwitchToSubscription label string

Kind: global constant
Returns: string - label

ParamTypeDescription
propertystringproperty to get from the language object

switchToSubscriptionLabel

Get the SwitchToSubscription label string for the item

Kind: global constant
Returns: string - label

ParamTypeDescription
itemobjectrebuy cart item

subscriptionOptionGroupLabel

Get the SwitchToSubscription subscription option group label string

Kind: global constant
Returns: string - label

ParamTypeDescription
itemobjectrebuy cart item

subscriptionOptionLabel

Get the SwitchToSubscription subscription option label string

Kind: global constant
Returns: string | number | void - label | frequency

ParamTypeDescription
itemobjectrebuy cart item
frequencynumbersubscription frequency (number of times per interval)
intervalstringsubscription interval (day, week, month, year)

getSettings

Get the settings for the SwitchToSubscription functionality

Kind: global function
Returns: object - settings

getBarForLocation

Get progress bar settings based on location

Kind: global constant
Returns: object - Progress bar settings object for the current location or default bar

ParamTypeDescription
countryCodestringCountry code for the current location

isProgressBarEnabled

Determine if the progress bar is enabled

Kind: global constant
Returns: boolean - - Boolean indicating whether the progress bar is enabled or not

getProgressBarSettings

Get the progress bar settings object

Kind: global constant
Returns: object - - The progress bar object | null

hasProgressPrompt

Determine if the progress bar has a prompt for the current tier

Kind: global constant
Returns: boolean | string - - A boolean value or a truthy string indicating whether the progress bar has a prompt or not

ParamTypeDescription
barobjectThe progress bar object

getTierCompletedText

Get the text for the completed tier

Kind: global constant
Returns: string - - The completed tier text

ParamTypeDescription
barobjectThe progress bar object
tierobjectThe tier object

getTierFeedbackText

Get the text for the current tier (either in progress or completed)

Kind: global constant
Returns: string - - The current tier text

ParamTypeDescription
barobjectThe progress bar object

getCurrentTier

Gets current tier

Kind: global constant
Returns: object | null - - Returns a tier object or null

ParamTypeDescription
barobjectThe progress bar object

getTierMinimum

Gets the minimum threshold for a given tier

Kind: global constant
Returns: number | null - - Returns the minimum threshold as a number or null

ParamTypeDescription
tierobjectThe tier object

getTierLabel

Gets the label for a given tier

Kind: global constant
Returns: string - - Returns the label as a string

ParamTypeDescription
tierobjectThe tier object

progressStepMaxWidth

Utility helper for getting the max width of the tiers for CSS

Kind: global constant
Returns: string - - Returns the max width as a string (percentage for CSS)

ParamTypeDescription
barobjectThe progress bar object

progressTierIcon

Utility helper for getting the icon for a given tier

Kind: global constant
Returns: string - - Returns the icon as an HTML string

ParamTypeDescription
tierobjectThe tier object

tierProgressIcon

Utility helper for getting the icon for a given tier (In Progress)

Kind: global constant
Returns: string - - Returns the icon as an HTML string

ParamTypeDescription
tierobjectThe tier object

tierCompleteIcon

Utility helper for getting the icon for a given tier (Complete)

Kind: global constant
Returns: string - - Returns the icon as an HTML string

ParamTypeDescription
tierobjectThe tier object

hasTierProgress

Determine if there is any progress to show in the progress bar

Kind: global constant

hasFreeShippingOnSubscription

Determine if Free Shipping should be satisfied by a subscription product in the Cart

Kind: global constant

calculatePercentageWithSubscriptionProduct

Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied

Kind: global constant

ParamTypeDescription
barobjectThe progress bar object

calculatePercentageWithNormalTierMinimums

Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied

Kind: global constant

ParamTypeDescription
barobjectThe progress bar object

tiersPercentageComplete

Calculates the progress bar's percentage completed

Kind: global constant

ParamTypeDescription
barobjectThe progress bar object
returnIntbooleanIndicates whether to return an integer or a string

progressTierReached

Determines if the tier has been reached based on the subtotal

Kind: global constant

ParamTypeDescription
tierobjectThe tier object

getSpendToNextTier

Gets the difference between the subtotal and the next tier's minimum

Kind: global constant

ParamTypeDescription
barobjectThe progress bar object

getEarnedProducts

Gets the list of earned products from the bar

Kind: global constant

ParamTypeDescription
barobjectThe progress bar object

freeProductPrompt

Gets text for the Free Product button - based on the product's status

Kind: global constant

ParamTypeDescription
productobjectThe product object

freeProductStyles

Gets the product's background image / styles

Kind: global constant
Returns: object | void - The styles object

ParamTypeDescription
productobjectThe product object

freeProductTileStyle

Gets the product's tile width, based on the number of earned products

Kind: global constant
Returns: object | void - The styles object

ParamTypeDescription
barobjectThe progress bar object

getFreeVariantTitle

Gets the product's title, if it's not the default title

Kind: global constant

ParamTypeDescription
productobjectThe product object

removeAllFreeGifts

Removes all cart products with the _attribution property set to ITEM_ATTRIBUTION.TIERED_PROGRESS_BAR

Kind: global constant

updateFreeProducts

Updates the free products in the cart based on the current subtotal. This contains the primary logic for the progress bar cart management

Kind: global constant

selectFreeProductVariant

Handles the selection of a free gift variant in the bar

Kind: global constant

ParamTypeDescription
eventobjectThe event object
productobjectThe product object

freeProductOptions

Gets the options for a free gift product - either all variants or selected variants

Kind: global constant
Returns: Array - - Array of variant objects

ParamTypeDescription
productobjectThe product object

addFreeProduct

Adds a free gift to the cart

Kind: global constant

ParamTypeDescription
productobjectThe product object

removeFreeProduct

Removes a free product from the cart + updates the declined gifts cookie

Kind: global constant

ParamTypeDescription
productobjectThe product object

getTieredBarProductData

Checks local storage for cached product data, and fetches any missing product data from the API

Kind: global constant
Returns: object - The updated progress bar object

ParamTypeDescription
barobjectThe progress bar object

getCartTitleHeadingTag

Get the cart title heading tag (h1, h2, h3, etc.)

Kind: global constant
Returns: string - the heading tag level for the cart title

getCartTitle

Get the cart title

Kind: global constant
Returns: string - the cart title text

getCartTitleClassName

Get the dynamic cart title class name - important for sr-only class

Kind: global constant
Returns: string - the dynamic cart title class name