Tiered Progress Bar Methods
- SmartCart.addFreeProduct ⇒
void -
Adds a free gift to the cart
- SmartCart.addSingleVariantFreeProduct
-
Adds the only available variant of a free gift product to the cart (used when there is only one variant available, which is either in variant_ids, or variants array)
- SmartCart.calculatePercentageWithNormalTierMinimums ⇒
number -
Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied
- SmartCart.calculatePercentageWithSubscriptionProduct ⇒
number -
Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied
- SmartCart.freeProductOptions ⇒
Array -
Gets the options for a free gift product - either all variants or selected variants
- SmartCart.freeProductPrompt ⇒
string -
Gets text for the Free Product button - based on the product's status
- SmartCart.freeProductStyles ⇒
object|void -
Gets the product's background image / styles
SmartCart.freeProductTileStyle ⇒object|undefined-
Gets the product's tile width, based on the number of earned products
- SmartCart.getBarForLocation ⇒
object -
Get progress bar settings based on location
- SmartCart.getCurrentTier ⇒
object|null -
Gets current tier
- SmartCart.getEarnedProducts ⇒
Array.<object> -
Gets the list of earned products from the bar
- SmartCart.getFreeVariantTitle ⇒
string -
Gets the gift product's variant title
- SmartCart.getGiftAreaTitle ⇒
string -
Gets the Gift Area Title to display above the Gift Area
- SmartCart.getProductsWithoutSelection ⇒
Array.<object> -
Gets the earned gifts in the cart that don't have a variant selected
- SmartCart.getProgressBarSettings ⇒
object|null -
Get the progress bar settings object
- SmartCart.getProgressStepIconSize ⇒
object -
Utility helper for getting the style object with configured sizes
- SmartCart.getSpendToNextTier ⇒
number -
Gets the difference between the subtotal and the next tier's minimum
- SmartCart.getTierCompletedText ⇒
string -
Get the text for the completed tier
- SmartCart.getTierFeedbackText ⇒
string -
Get the text for the current tier (either in progress or completed)
- SmartCart.getTierLabel ⇒
string -
Gets the step label for a given tier
- SmartCart.getTierMinimum ⇒
number|null -
Gets the minimum threshold for a given tier
- SmartCart.getTieredBarProductData ⇒
object -
Checks local storage for cached product data, and fetches any missing product data from the API
- SmartCart.hasFreeShippingOnSubscription ⇒
boolean -
Determine if Free Shipping should be satisfied by a subscription product in the Cart
- SmartCart.hasGiftSelection ⇒
boolean -
Determine if the gift product requires a customer variant selection
- SmartCart.hasProgressPrompt ⇒
boolean|string -
Determine if the progress bar has a prompt for the current tier
- SmartCart.hasTierProgress ⇒
boolean -
Determine if there is any progress to show in the progress bar
- SmartCart.isGiftItem ⇒
boolean -
Determines whether a cart item is a free gift item from the progress bar
- SmartCart.isProgressBarEnabled ⇒
boolean -
Determine if the progress bar is enabled
- SmartCart.progressBarSubtotal ⇒
number -
Gets the current subtotal for the TPB, with some exclusion logic
- SmartCart.progressStepMaxWidth ⇒
string -
Utility helper for getting the max width of the tiers for CSS
- SmartCart.progressTierIcon ⇒
string -
Utility helper for getting the icon for a given tier
- SmartCart.progressTierReached ⇒
boolean -
Determines if the tier has been reached based on the subtotal
- SmartCart.removeAllFreeGifts
-
Removes all free gifts from the cart
- SmartCart.removeFreeProduct
-
Deselects a free gift from the TPB Gift Area:
- Updates the product status to loading
- Removes the gift from the cart
- Updates the product status to removed
- Adds the gift to the declined gifts cookie
- SmartCart.selectFreeProductVariant
-
Handles the selection of a free gift variant in the bar
- SmartCart.shouldFilterOutOfStockVariantsFromTier ⇒
boolean -
Determines whether Out of Stock variants should be hidden from the progress bar
- SmartCart.shouldRenderEarnedGift ⇒
boolean -
Determines whether a gift product in the earned products array should be rendered with the bar (helpful to prevent rendering out chosen gifts with the bar while in Line Item Mode)
- SmartCart.shouldRenderGiftArea ⇒
boolean -
Determines whether the Gifts Area should be rendered based on the progress bar settings and earned products state
- SmartCart.shouldRenderGiftAreaTitle ⇒
boolean -
Determine if the Gift Area Title should be used
- SmartCart.tierCompleteIcon ⇒
string -
Utility helper for getting the icon for a given tier (Complete)
- SmartCart.tierProgressIcon ⇒
string -
Utility helper for getting the icon for a given tier (In Progress)
- SmartCart.tiersPercentageComplete ⇒
string|number -
Calculates the progress bar's percentage completed
- SmartCart.updateFreeProducts
-
Updates the free products in the cart based on the current subtotal. This contains the primary logic for the progress bar cart management
SmartCart.addFreeProduct ⇒ void¶
Adds a free gift to the cart
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object |
SmartCart.addSingleVariantFreeProduct¶
Adds the only available variant of a free gift product to the cart\ (used when there is only one variant available, which is either in variant_ids, or variants array)
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object |
SmartCart.calculatePercentageWithNormalTierMinimums ⇒ number¶
Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied
Returns: number - The percentage as a number
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.calculatePercentageWithSubscriptionProduct ⇒ number¶
Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied
Returns: number - The percentage as a number
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.freeProductOptions ⇒ Array¶
Gets the options for a free gift product - either all variants or selected variants
Returns: Array - Array of variant objects
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object (from the earnedProducts array) |
SmartCart.freeProductPrompt ⇒ string¶
Gets text for the Free Product button - based on the product's status
Returns: string - The text for the button
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object |
SmartCart.freeProductStyles ⇒ object | void¶
Gets the product's background image / styles
Returns: object | void - The styles object
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object |
~~freeProductTileStyle ⇒ object | undefined~~¶
Deprecated
Gets the product's tile width, based on the number of earned products
Returns: object | undefined - The styles object
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getBarForLocation ⇒ object¶
Get progress bar settings based on location
Returns: object - Progress bar settings object for the current location or default bar
| Param | Type | Description |
|---|---|---|
| countryCode |
string
|
Country code for the current location |
SmartCart.getCurrentTier ⇒ object | null¶
Gets current tier
Returns: object | null - Returns a tier object or null
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getEarnedProducts ⇒ Array.\¶
Gets the list of earned products from the bar
Returns: Array.\ - The list of earned products
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getFreeVariantTitle ⇒ string¶
Gets the gift product's variant title
Returns: string - The applied gift variant title
| Param | Type | Description |
|---|---|---|
| product |
object
|
The product object |
SmartCart.getGiftAreaTitle ⇒ string¶
Gets the Gift Area Title to display above the Gift Area
Returns: string - The Gift Area Title
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getProductsWithoutSelection ⇒ Array.\¶
Gets the earned gifts in the cart that don't have a variant selected
Returns: Array.\ - The earned products in the cart that don't have a variant selected
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getProgressBarSettings ⇒ object | null¶
Get the progress bar settings object
Returns: object | null - The progress bar settings object | null\
SmartCart.getProgressStepIconSize ⇒ object¶
Utility helper for getting the style object with configured sizes
Returns: object - Returns the style object with width and height defined for the image
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.getSpendToNextTier ⇒ number¶
Gets the difference between the subtotal and the next tier's minimum
Returns: number - The difference as a number
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getTierCompletedText ⇒ string¶
Get the text for the completed tier
Returns: string - The completed tier text
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
| tier |
object
|
The tier object |
SmartCart.getTierFeedbackText ⇒ string¶
Get the text for the current tier (either in progress or completed)
Returns: string - The current tier text
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.getTierLabel ⇒ string¶
Gets the step label for a given tier
Returns: string - Returns the label as a string
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.getTierMinimum ⇒ number | null¶
Gets the minimum threshold for a given tier
Returns: number | null - Returns the minimum threshold as a number or null
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.getTieredBarProductData ⇒ object¶
Checks local storage for cached product data, and fetches any missing product data from the API
Returns: object - The updated progress bar object
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.hasFreeShippingOnSubscription ⇒ boolean¶
Determine if Free Shipping should be satisfied by a subscription product in the Cart
Returns: boolean - Boolean indicating whether Free Shipping should be satisfied by a subscription product\
SmartCart.hasGiftSelection ⇒ boolean¶
Determine if the gift product requires a customer variant selection
Returns: boolean - Boolean indicating whether the gift product has a variant selection
| Param | Type | Description |
|---|---|---|
| product |
object
|
The gift product object |
SmartCart.hasProgressPrompt ⇒ boolean | string¶
Determine if the progress bar has a prompt for the current tier
Returns: boolean | string - A boolean value or a truthy string indicating whether the progress bar has a prompt or not
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.hasTierProgress ⇒ boolean¶
Determine if there is any progress to show in the progress bar
Returns: boolean - Boolean indicating whether there is any progress to show\
SmartCart.isGiftItem ⇒ boolean¶
Determines whether a cart item is a free gift item from the progress bar
Returns: boolean - Boolean indicating whether the item is a free gift item
| Param | Type | Description |
|---|---|---|
| item |
object
|
Shopify cart item object |
SmartCart.isProgressBarEnabled ⇒ boolean¶
Determine if the progress bar is enabled
Returns: boolean - Boolean indicating whether the progress bar is enabled or not\
SmartCart.progressBarSubtotal ⇒ number¶
Gets the current subtotal for the TPB, with some exclusion logic
Returns: number - the current subtotal (with exclusions)\
SmartCart.progressStepMaxWidth ⇒ string¶
Utility helper for getting the max width of the tiers for CSS
Returns: string - Returns the max width as a string (percentage for CSS)
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.progressTierIcon ⇒ string¶
Utility helper for getting the icon for a given tier
Returns: string - Returns the icon as an HTML string
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.progressTierReached ⇒ boolean¶
Determines if the tier has been reached based on the subtotal
Returns: boolean - Boolean indicating whether the tier has been reached
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.removeAllFreeGifts¶
Removes all free gifts from the cart
SmartCart.removeFreeProduct¶
Deselects a free gift from the TPB Gift Area:
- Updates the product status to loading
- Removes the gift from the cart
- Updates the product status to removed
- Adds the gift to the declined gifts cookie
| Param | Type | Description |
|---|---|---|
| product |
object
|
The earned product object (from the bar.earnedProducts array) |
| callback |
function
|
The callback function to run after the gift has been removed |
SmartCart.selectFreeProductVariant¶
Handles the selection of a free gift variant in the bar
| Param | Type | Description |
|---|---|---|
| event |
object
|
The event object |
| product |
object
|
The product object |
SmartCart.shouldFilterOutOfStockVariantsFromTier ⇒ boolean¶
Determines whether Out of Stock variants should be hidden from the progress bar
Returns: boolean - Boolean indicating whether Out of Stock variants should be hidden for this tier
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.shouldRenderEarnedGift ⇒ boolean¶
Determines whether a gift product in the earned products array should be rendered with the bar\ (helpful to prevent rendering out chosen gifts with the bar while in Line Item Mode)
Returns: boolean - Boolean indicating whether the gift product should be rendered with the bar
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
| product |
object
|
The gift product object |
SmartCart.shouldRenderGiftArea ⇒ boolean¶
Determines whether the Gifts Area should be rendered based on the progress bar settings and earned products state
Returns: boolean - Boolean indicating whether the Gifts Area should be rendered
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.shouldRenderGiftAreaTitle ⇒ boolean¶
Determine if the Gift Area Title should be used
Returns: boolean - Boolean indicating whether the Gift Area Title should be used
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
SmartCart.tierCompleteIcon ⇒ string¶
Utility helper for getting the icon for a given tier (Complete)
Returns: string - Returns the icon as an HTML string
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.tierProgressIcon ⇒ string¶
Utility helper for getting the icon for a given tier (In Progress)
Returns: string - Returns the icon as an HTML string
| Param | Type | Description |
|---|---|---|
| tier |
object
|
The tier object |
SmartCart.tiersPercentageComplete ⇒ string | number¶
Calculates the progress bar's percentage completed
Returns: string | number - The percentage as a string or number
| Param | Type | Description |
|---|---|---|
| bar |
object
|
The progress bar object |
| returnInt |
boolean
|
Indicates whether to return an integer or a string |
SmartCart.updateFreeProducts¶
Updates the free products in the cart based on the current subtotal.\ This contains the primary logic for the progress bar cart management
--- title: Tiered Progress Bar Methods excerpt: '' deprecated: false hidden: false metadata: title: '' description: '' robots: index next: description: Return to the New Methods Overview Page to see other available methods. pages: - type: endpoint slug: smart-cart-methods title: Methods Overview - New --- <dl> <dt><a href="#SmartCart.addFreeProduct">SmartCart.addFreeProduct</a> ⇒ <code>void</code></dt> <dd> <p>Adds a free gift to the cart</p> </dd> <dt><a href="#SmartCart.addSingleVariantFreeProduct">SmartCart.addSingleVariantFreeProduct</a></dt> <dd> <p>Adds the only available variant of a free gift product to the cart (used when there is only one variant available, which is either in variant_ids, or variants array)</p> </dd> <dt><a href="#SmartCart.calculatePercentageWithNormalTierMinimums">SmartCart.calculatePercentageWithNormalTierMinimums</a> ⇒ <code>number</code></dt> <dd> <p>Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied</p> </dd> <dt><a href="#SmartCart.calculatePercentageWithSubscriptionProduct">SmartCart.calculatePercentageWithSubscriptionProduct</a> ⇒ <code>number</code></dt> <dd> <p>Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied</p> </dd> <dt><a href="#SmartCart.freeProductOptions">SmartCart.freeProductOptions</a> ⇒ <code>Array</code></dt> <dd> <p>Gets the options for a free gift product - either all variants or selected variants</p> </dd> <dt><a href="#SmartCart.freeProductPrompt">SmartCart.freeProductPrompt</a> ⇒ <code>string</code></dt> <dd> <p>Gets text for the Free Product button - based on the product's status</p> </dd> <dt><a href="#SmartCart.freeProductStyles">SmartCart.freeProductStyles</a> ⇒ <code>object</code> | <code>void</code></dt> <dd> <p>Gets the product's background image / styles</p> </dd> <dt><del><a href="#SmartCart.freeProductTileStyle">SmartCart.freeProductTileStyle</a> ⇒ <code>object</code> | <code>undefined</code></del></dt> <dd> <p>Gets the product's tile width, based on the number of earned products</p> </dd> <dt><a href="#SmartCart.getBarForLocation">SmartCart.getBarForLocation</a> ⇒ <code>object</code></dt> <dd> <p>Get progress bar settings based on location</p> </dd> <dt><a href="#SmartCart.getCurrentTier">SmartCart.getCurrentTier</a> ⇒ <code>object</code> | <code>null</code></dt> <dd> <p>Gets current tier</p> </dd> <dt><a href="#SmartCart.getEarnedProducts">SmartCart.getEarnedProducts</a> ⇒ <code>Array.<object></code></dt> <dd> <p>Gets the list of earned products from the bar</p> </dd> <dt><a href="#SmartCart.getFreeVariantTitle">SmartCart.getFreeVariantTitle</a> ⇒ <code>string</code></dt> <dd> <p>Gets the gift product's variant title</p> </dd> <dt><a href="#SmartCart.getGiftAreaTitle">SmartCart.getGiftAreaTitle</a> ⇒ <code>string</code></dt> <dd> <p>Gets the Gift Area Title to display above the Gift Area</p> </dd> <dt><a href="#SmartCart.getProductsWithoutSelection">SmartCart.getProductsWithoutSelection</a> ⇒ <code>Array.<object></code></dt> <dd> <p>Gets the earned gifts in the cart that don't have a variant selected</p> </dd> <dt><a href="#SmartCart.getProgressBarSettings">SmartCart.getProgressBarSettings</a> ⇒ <code>object</code> | <code>null</code></dt> <dd> <p>Get the progress bar settings object</p> </dd> <dt><a href="#SmartCart.getProgressStepIconSize">SmartCart.getProgressStepIconSize</a> ⇒ <code>object</code></dt> <dd> <p>Utility helper for getting the style object with configured sizes</p> </dd> <dt><a href="#SmartCart.getSpendToNextTier">SmartCart.getSpendToNextTier</a> ⇒ <code>number</code></dt> <dd> <p>Gets the difference between the subtotal and the next tier's minimum</p> </dd> <dt><a href="#SmartCart.getTierCompletedText">SmartCart.getTierCompletedText</a> ⇒ <code>string</code></dt> <dd> <p>Get the text for the completed tier</p> </dd> <dt><a href="#SmartCart.getTierFeedbackText">SmartCart.getTierFeedbackText</a> ⇒ <code>string</code></dt> <dd> <p>Get the text for the current tier (either in progress or completed)</p> </dd> <dt><a href="#SmartCart.getTierLabel">SmartCart.getTierLabel</a> ⇒ <code>string</code></dt> <dd> <p>Gets the step label for a given tier</p> </dd> <dt><a href="#SmartCart.getTierMinimum">SmartCart.getTierMinimum</a> ⇒ <code>number</code> | <code>null</code></dt> <dd> <p>Gets the minimum threshold for a given tier</p> </dd> <dt><a href="#SmartCart.getTieredBarProductData">SmartCart.getTieredBarProductData</a> ⇒ <code>object</code></dt> <dd> <p>Checks local storage for cached product data, and fetches any missing product data from the API</p> </dd> <dt><a href="#SmartCart.hasFreeShippingOnSubscription">SmartCart.hasFreeShippingOnSubscription</a> ⇒ <code>boolean</code></dt> <dd> <p>Determine if Free Shipping should be satisfied by a subscription product in the Cart</p> </dd> <dt><a href="#SmartCart.hasGiftSelection">SmartCart.hasGiftSelection</a> ⇒ <code>boolean</code></dt> <dd> <p>Determine if the gift product requires a customer variant selection</p> </dd> <dt><a href="#SmartCart.hasProgressPrompt">SmartCart.hasProgressPrompt</a> ⇒ <code>boolean</code> | <code>string</code></dt> <dd> <p>Determine if the progress bar has a prompt for the current tier</p> </dd> <dt><a href="#SmartCart.hasTierProgress">SmartCart.hasTierProgress</a> ⇒ <code>boolean</code></dt> <dd> <p>Determine if there is any progress to show in the progress bar</p> </dd> <dt><a href="#SmartCart.isGiftItem">SmartCart.isGiftItem</a> ⇒ <code>boolean</code></dt> <dd> <p>Determines whether a cart item is a free gift item from the progress bar</p> </dd> <dt><a href="#SmartCart.isProgressBarEnabled">SmartCart.isProgressBarEnabled</a> ⇒ <code>boolean</code></dt> <dd> <p>Determine if the progress bar is enabled</p> </dd> <dt><a href="#SmartCart.progressBarSubtotal">SmartCart.progressBarSubtotal</a> ⇒ <code>number</code></dt> <dd> <p>Gets the current subtotal for the TPB, with some exclusion logic</p> </dd> <dt><a href="#SmartCart.progressStepMaxWidth">SmartCart.progressStepMaxWidth</a> ⇒ <code>string</code></dt> <dd> <p>Utility helper for getting the max width of the tiers for CSS</p> </dd> <dt><a href="#SmartCart.progressTierIcon">SmartCart.progressTierIcon</a> ⇒ <code>string</code></dt> <dd> <p>Utility helper for getting the icon for a given tier</p> </dd> <dt><a href="#SmartCart.progressTierReached">SmartCart.progressTierReached</a> ⇒ <code>boolean</code></dt> <dd> <p>Determines if the tier has been reached based on the subtotal</p> </dd> <dt><a href="#SmartCart.removeAllFreeGifts">SmartCart.removeAllFreeGifts</a></dt> <dd> <p>Removes all free gifts from the cart</p> </dd> <dt><a href="#SmartCart.removeFreeProduct">SmartCart.removeFreeProduct</a></dt> <dd> <p>Deselects a free gift from the TPB Gift Area:</p> <ul> <li>Updates the product status to loading</li> <li>Removes the gift from the cart</li> <li>Updates the product status to removed</li> <li>Adds the gift to the declined gifts cookie</li> </ul> </dd> <dt><a href="#SmartCart.selectFreeProductVariant">SmartCart.selectFreeProductVariant</a></dt> <dd> <p>Handles the selection of a free gift variant in the bar</p> </dd> <dt><a href="#SmartCart.shouldFilterOutOfStockVariantsFromTier">SmartCart.shouldFilterOutOfStockVariantsFromTier</a> ⇒ <code>boolean</code></dt> <dd> <p>Determines whether Out of Stock variants should be hidden from the progress bar</p> </dd> <dt><a href="#SmartCart.shouldRenderEarnedGift">SmartCart.shouldRenderEarnedGift</a> ⇒ <code>boolean</code></dt> <dd> <p>Determines whether a gift product in the earned products array should be rendered with the bar (helpful to prevent rendering out chosen gifts with the bar while in Line Item Mode)</p> </dd> <dt><a href="#SmartCart.shouldRenderGiftArea">SmartCart.shouldRenderGiftArea</a> ⇒ <code>boolean</code></dt> <dd> <p>Determines whether the Gifts Area should be rendered based on the progress bar settings and earned products state</p> </dd> <dt><a href="#SmartCart.shouldRenderGiftAreaTitle">SmartCart.shouldRenderGiftAreaTitle</a> ⇒ <code>boolean</code></dt> <dd> <p>Determine if the Gift Area Title should be used</p> </dd> <dt><a href="#SmartCart.tierCompleteIcon">SmartCart.tierCompleteIcon</a> ⇒ <code>string</code></dt> <dd> <p>Utility helper for getting the icon for a given tier (Complete)</p> </dd> <dt><a href="#SmartCart.tierProgressIcon">SmartCart.tierProgressIcon</a> ⇒ <code>string</code></dt> <dd> <p>Utility helper for getting the icon for a given tier (In Progress)</p> </dd> <dt><a href="#SmartCart.tiersPercentageComplete">SmartCart.tiersPercentageComplete</a> ⇒ <code>string</code> | <code>number</code></dt> <dd> <p>Calculates the progress bar's percentage completed</p> </dd> <dt><a href="#SmartCart.updateFreeProducts">SmartCart.updateFreeProducts</a></dt> <dd> <p>Updates the free products in the cart based on the current subtotal. This contains the primary logic for the progress bar cart management</p> </dd> </dl> <a name="SmartCart.addFreeProduct"></a> ## `SmartCart.addFreeProduct` ⇒ <code>void</code> Adds a free gift to the cart <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.addSingleVariantFreeProduct"></a> ## `SmartCart.addSingleVariantFreeProduct` Adds the only available variant of a free gift product to the cart\ (used when there is only one variant available, which is either in variant_ids, or variants array) <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.calculatePercentageWithNormalTierMinimums"></a> ## `SmartCart.calculatePercentageWithNormalTierMinimums` ⇒ <code>number</code> Calculates the progress bar's percentage when there is no Free Shipping On Subscription option enabled / satisfied **Returns**: <code>number</code> - The percentage as a number <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.calculatePercentageWithSubscriptionProduct"></a> ## `SmartCart.calculatePercentageWithSubscriptionProduct` ⇒ <code>number</code> Calculates the progress bar's percentage when there is a Free Shipping On Subscription option enabled + satisfied **Returns**: <code>number</code> - The percentage as a number <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.freeProductOptions"></a> ## `SmartCart.freeProductOptions` ⇒ <code>Array</code> Gets the options for a free gift product - either all variants or selected variants **Returns**: <code>Array</code> - Array of variant objects <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object (from the earnedProducts array) </td> </tr> </tbody> </Table> <a name="SmartCart.freeProductPrompt"></a> ## `SmartCart.freeProductPrompt` ⇒ <code>string</code> Gets text for the Free Product button - based on the product's status **Returns**: <code>string</code> - The text for the button <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.freeProductStyles"></a> ## `SmartCart.freeProductStyles` ⇒ <code>object</code> \| <code>void</code> Gets the product's background image / styles **Returns**: <code>object</code> \| <code>void</code> - The styles object <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.freeProductTileStyle"></a> ## ~~freeProductTileStyle ⇒ <code>object</code> \| <code>undefined</code>~~ ***Deprecated*** Gets the product's tile width, based on the number of earned products **Returns**: <code>object</code> \| <code>undefined</code> - The styles object <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getBarForLocation"></a> ## `SmartCart.getBarForLocation` ⇒ <code>object</code> Get progress bar settings based on location **Returns**: <code>object</code> - Progress bar settings object for the current location or default bar <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> countryCode </td> <td> <code>string</code> </td> <td> Country code for the current location </td> </tr> </tbody> </Table> <a name="SmartCart.getCurrentTier"></a> ## `SmartCart.getCurrentTier` ⇒ <code>object</code> \| <code>null</code> Gets current tier **Returns**: <code>object</code> \| <code>null</code> - Returns a tier object or null <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getEarnedProducts"></a> ## `SmartCart.getEarnedProducts` ⇒ <code>Array.\<object></code> Gets the list of earned products from the bar **Returns**: <code>Array.\<object></code> - The list of earned products <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getFreeVariantTitle"></a> ## `SmartCart.getFreeVariantTitle` ⇒ <code>string</code> Gets the gift product's variant title **Returns**: <code>string</code> - The applied gift variant title <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.getGiftAreaTitle"></a> ## `SmartCart.getGiftAreaTitle` ⇒ <code>string</code> Gets the Gift Area Title to display above the Gift Area **Returns**: <code>string</code> - The Gift Area Title <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getProductsWithoutSelection"></a> ## `SmartCart.getProductsWithoutSelection` ⇒ <code>Array.\<object></code> Gets the earned gifts in the cart that don't have a variant selected **Returns**: <code>Array.\<object></code> - The earned products in the cart that don't have a variant selected <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getProgressBarSettings"></a> ## `SmartCart.getProgressBarSettings` ⇒ <code>object</code> \| <code>null</code> Get the progress bar settings object **Returns**: <code>object</code> \| <code>null</code> - The progress bar settings object | null\ <a name="SmartCart.getProgressStepIconSize"></a> ## `SmartCart.getProgressStepIconSize` ⇒ <code>object</code> Utility helper for getting the style object with configured sizes **Returns**: <code>object</code> - Returns the style object with width and height defined for the image <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.getSpendToNextTier"></a> ## `SmartCart.getSpendToNextTier` ⇒ <code>number</code> Gets the difference between the subtotal and the next tier's minimum **Returns**: <code>number</code> - The difference as a number <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getTierCompletedText"></a> ## `SmartCart.getTierCompletedText` ⇒ <code>string</code> Get the text for the completed tier **Returns**: <code>string</code> - The completed tier text <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.getTierFeedbackText"></a> ## `SmartCart.getTierFeedbackText` ⇒ <code>string</code> Get the text for the current tier (either in progress or completed) **Returns**: <code>string</code> - The current tier text <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.getTierLabel"></a> ## `SmartCart.getTierLabel` ⇒ <code>string</code> Gets the step label for a given tier **Returns**: <code>string</code> - Returns the label as a string <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.getTierMinimum"></a> ## `SmartCart.getTierMinimum` ⇒ <code>number</code> \| <code>null</code> Gets the minimum threshold for a given tier **Returns**: <code>number</code> \| <code>null</code> - Returns the minimum threshold as a number or null <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.getTieredBarProductData"></a> ## `SmartCart.getTieredBarProductData` ⇒ <code>object</code> Checks local storage for cached product data, and fetches any missing product data from the API **Returns**: <code>object</code> - The updated progress bar object <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.hasFreeShippingOnSubscription"></a> ## `SmartCart.hasFreeShippingOnSubscription` ⇒ <code>boolean</code> Determine if Free Shipping should be satisfied by a subscription product in the Cart **Returns**: <code>boolean</code> - Boolean indicating whether Free Shipping should be satisfied by a subscription product\ <a name="SmartCart.hasGiftSelection"></a> ## `SmartCart.hasGiftSelection` ⇒ <code>boolean</code> Determine if the gift product requires a customer variant selection **Returns**: <code>boolean</code> - Boolean indicating whether the gift product has a variant selection <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The gift product object </td> </tr> </tbody> </Table> <a name="SmartCart.hasProgressPrompt"></a> ## `SmartCart.hasProgressPrompt` ⇒ <code>boolean</code> \| <code>string</code> Determine if the progress bar has a prompt for the current tier **Returns**: <code>boolean</code> \| <code>string</code> - A boolean value or a truthy string indicating whether the progress bar has a prompt or not <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.hasTierProgress"></a> ## `SmartCart.hasTierProgress` ⇒ <code>boolean</code> Determine if there is any progress to show in the progress bar **Returns**: <code>boolean</code> - Boolean indicating whether there is any progress to show\ <a name="SmartCart.isGiftItem"></a> ## `SmartCart.isGiftItem` ⇒ <code>boolean</code> Determines whether a cart item is a free gift item from the progress bar **Returns**: <code>boolean</code> - Boolean indicating whether the item is a free gift item <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> item </td> <td> <code>object</code> </td> <td> Shopify cart item object </td> </tr> </tbody> </Table> <a name="SmartCart.isProgressBarEnabled"></a> ## `SmartCart.isProgressBarEnabled` ⇒ <code>boolean</code> Determine if the progress bar is enabled **Returns**: <code>boolean</code> - Boolean indicating whether the progress bar is enabled or not\ <a name="SmartCart.progressBarSubtotal"></a> ## `SmartCart.progressBarSubtotal` ⇒ <code>number</code> Gets the current subtotal for the TPB, with some exclusion logic **Returns**: <code>number</code> - the current subtotal (with exclusions)\ <a name="SmartCart.progressStepMaxWidth"></a> ## `SmartCart.progressStepMaxWidth` ⇒ <code>string</code> Utility helper for getting the max width of the tiers for CSS **Returns**: <code>string</code> - Returns the max width as a string (percentage for CSS) <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.progressTierIcon"></a> ## `SmartCart.progressTierIcon` ⇒ <code>string</code> Utility helper for getting the icon for a given tier **Returns**: <code>string</code> - Returns the icon as an HTML string <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.progressTierReached"></a> ## `SmartCart.progressTierReached` ⇒ <code>boolean</code> Determines if the tier has been reached based on the subtotal **Returns**: <code>boolean</code> - Boolean indicating whether the tier has been reached <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.removeAllFreeGifts"></a> ## `SmartCart.removeAllFreeGifts` Removes all free gifts from the cart <a name="SmartCart.removeFreeProduct"></a> ## `SmartCart.removeFreeProduct` Deselects a free gift from the TPB Gift Area: * Updates the product status to loading * Removes the gift from the cart * Updates the product status to removed * Adds the gift to the declined gifts cookie <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> product </td> <td> <code>object</code> </td> <td> The earned product object (from the bar.earnedProducts array) </td> </tr> <tr> <td> callback </td> <td> <code>function</code> </td> <td> The callback function to run after the gift has been removed </td> </tr> </tbody> </Table> <a name="SmartCart.selectFreeProductVariant"></a> ## `SmartCart.selectFreeProductVariant` Handles the selection of a free gift variant in the bar <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> event </td> <td> <code>object</code> </td> <td> The event object </td> </tr> <tr> <td> product </td> <td> <code>object</code> </td> <td> The product object </td> </tr> </tbody> </Table> <a name="SmartCart.shouldFilterOutOfStockVariantsFromTier"></a> ## `SmartCart.shouldFilterOutOfStockVariantsFromTier` ⇒ <code>boolean</code> Determines whether Out of Stock variants should be hidden from the progress bar **Returns**: <code>boolean</code> - Boolean indicating whether Out of Stock variants should be hidden for this tier <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.shouldRenderEarnedGift"></a> ## `SmartCart.shouldRenderEarnedGift` ⇒ <code>boolean</code> Determines whether a gift product in the earned products array should be rendered with the bar\ (helpful to prevent rendering out chosen gifts with the bar while in Line Item Mode) **Returns**: <code>boolean</code> - Boolean indicating whether the gift product should be rendered with the bar <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> <tr> <td> product </td> <td> <code>object</code> </td> <td> The gift product object </td> </tr> </tbody> </Table> <a name="SmartCart.shouldRenderGiftArea"></a> ## `SmartCart.shouldRenderGiftArea` ⇒ <code>boolean</code> Determines whether the Gifts Area should be rendered based on the progress bar settings and earned products state **Returns**: <code>boolean</code> - Boolean indicating whether the Gifts Area should be rendered <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.shouldRenderGiftAreaTitle"></a> ## `SmartCart.shouldRenderGiftAreaTitle` ⇒ <code>boolean</code> Determine if the Gift Area Title should be used **Returns**: <code>boolean</code> - Boolean indicating whether the Gift Area Title should be used <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> </tbody> </Table> <a name="SmartCart.tierCompleteIcon"></a> ## `SmartCart.tierCompleteIcon` ⇒ <code>string</code> Utility helper for getting the icon for a given tier (Complete) **Returns**: <code>string</code> - Returns the icon as an HTML string <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.tierProgressIcon"></a> ## `SmartCart.tierProgressIcon` ⇒ <code>string</code> Utility helper for getting the icon for a given tier (In Progress) **Returns**: <code>string</code> - Returns the icon as an HTML string <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> tier </td> <td> <code>object</code> </td> <td> The tier object </td> </tr> </tbody> </Table> <a name="SmartCart.tiersPercentageComplete"></a> ## `SmartCart.tiersPercentageComplete` ⇒ <code>string</code> \| <code>number</code> Calculates the progress bar's percentage completed **Returns**: <code>string</code> \| <code>number</code> - The percentage as a string or number <Table> <thead> <tr> <th> Param </th> <th> Type </th> <th> Description </th> </tr> </thead> <tbody> <tr> <td> bar </td> <td> <code>object</code> </td> <td> The progress bar object </td> </tr> <tr> <td> returnInt </td> <td> <code>boolean</code> </td> <td> Indicates whether to return an integer or a string </td> </tr> </tbody> </Table> <a name="SmartCart.updateFreeProducts"></a> ## `SmartCart.updateFreeProducts` Updates the free products in the cart based on the current subtotal.\ This contains the primary logic for the progress bar cart management