- SmartCart.currency ⇒
string
Gets the current cart currency code
- SmartCart.destroy
Destroys the Smart Cart instance, removes it from the DOM, unbinds events, and resets default properties
- SmartCart.discountTotal ⇒
string
Gets the discount total string to display in the Smart Cart
- SmartCart.emptyCartMarkup ⇒
string
Gets the empty cart markup from the settings object
- SmartCart.enrich
Enriches the cart product data, either pulling it from local storage or re-fetching it
- SmartCart.formatMoney ⇒
string
Formats a money amount with the specified format and current cart currency (used to render money amounts in the Smart Cart)
- SmartCart.getCalculatedCartDiscount ⇒
number
Gets the calculated discount for the cart, based on detected automatic discounts OR applied discount codes
- SmartCart.getComponentsByType ⇒
Array
Gets all of the Smart Cart components of a specific type from the settings.components array
- SmartCart.getFirstComponentByType ⇒
object
|undefined
Gets the first Smart Cart component of a specific type from the settings.components array. This is useful for components that should only have one instance (ie. the title component)
- SmartCart.getOriginalCartTotal ⇒
number
Gets the cart original price (before discounts). Some items are excluded from the subtotal calculation.
- SmartCart.getVueConfig ⇒
object
Defines the Smart Cart's Vue configuration object
- SmartCart.hide
Hides the Smart Cart from the customer, stops any announcement bars, and triggers the Smart Cart hide event
- SmartCart.init
Initializes the Smart Cart
- SmartCart.isComponentVisible ⇒
boolean
Determines whether a Smart Cart component is visible based on its visibility status
- SmartCart.setCart
Sets the internal SmartCart.cart object, syncs the cart note (if applicable), and enriches the cart product data
- SmartCart.shouldUseProductMetafields ⇒
boolean
Gets the setting value for Enable Product Metafields in the Smart Cart (used to determine whether to include product metafields in the Smart Cart enriched data)
- SmartCart.show
Shows the Smart Cart to the customer, initializes any announcement bars, and triggers the Smart Cart show event
- SmartCart.sizeImage ⇒
string
Gets a Shopify image size URL with a specified size
- SmartCart.updateCartCount
Updates the Cart Item Count element with the current item count (if the Item Count selector is defined in the Theme Selectors in settings)
- SmartCart.updateCartSubtotal
Updates the Cart Subtotal element with the current subtotal (if the Cart Subtotal selector is defined in the Theme Selectors in settings)
- SmartCart.updateLiveRegion
Updates the ARIA Live Region in the Smart Cart with a message
SmartCart.currency
⇒ string
SmartCart.currency
⇒ string
Gets the current cart currency code
Returns: string
- the currency code for the current Shopify cart object
SmartCart.destroy
SmartCart.destroy
Destroys the Smart Cart instance, removes it from the DOM, unbinds events, and resets default properties
SmartCart.discountTotal
⇒ string
SmartCart.discountTotal
⇒ string
Gets the discount total string to display in the Smart Cart
Returns: string
- The total discount amount (formatted)
Param | Type | Description |
---|---|---|
format | string | Money formatting string (ie. '${{amount}}' ) |
SmartCart.emptyCartMarkup
⇒ string
SmartCart.emptyCartMarkup
⇒ string
Gets the empty cart markup from the settings object
Returns: string
- The empty cart markup
SmartCart.enrich
SmartCart.enrich
Enriches the cart product data, either pulling it from local storage or re-fetching it
SmartCart.formatMoney
⇒ string
SmartCart.formatMoney
⇒ string
Formats a money amount with the specified format and current cart currency
(used to render money amounts in the Smart Cart)
Returns: string
- The formatted money amount
Param | Type | Description |
---|---|---|
amount | number | string | The money amount to format |
[format] | string | Money formatting string (ie. '${{amount}}' ) |
[currencyCode] | string | The currency code to use for formatting |
SmartCart.getCalculatedCartDiscount
⇒ number
SmartCart.getCalculatedCartDiscount
⇒ number
Gets the calculated discount for the cart, based on detected automatic discounts OR applied discount codes
Returns: number
- The total discount amount for the cart
SmartCart.getComponentsByType
⇒ Array
SmartCart.getComponentsByType
⇒ Array
Gets all of the Smart Cart components of a specific type from the settings.components array
Returns: Array
- An array of Smart Cart components of the specified type
Param | Type | Description |
---|---|---|
type | string | The component type to filter by |
SmartCart.getFirstComponentByType
⇒ object
| undefined
SmartCart.getFirstComponentByType
⇒ object
| undefined
Gets the first Smart Cart component of a specific type from the settings.components array.
This is useful for components that should only have one instance (ie. the title component)
Returns: object
| undefined
- The first Smart Cart component of the specified type
Param | Type | Description |
---|---|---|
type | string | The component type to filter by |
SmartCart.getOriginalCartTotal
⇒ number
SmartCart.getOriginalCartTotal
⇒ number
Gets the cart original price (before discounts). Some items are excluded from the subtotal calculation.
Returns: number
- The original price of the cart (included items original prices combined)
SmartCart.getVueConfig
⇒ object
SmartCart.getVueConfig
⇒ object
Defines the Smart Cart's Vue configuration object
Returns: object
- Vue configuration object
SmartCart.hide
SmartCart.hide
Hides the Smart Cart from the customer, stops any announcement bars, and triggers the Smart Cart hide event
Param | Type | Description |
---|---|---|
e | event | The event object (if applicable) |
SmartCart.init
SmartCart.init
Initializes the Smart Cart
Param | Type | Description |
---|---|---|
settings | object | The Smart Cart settings object |
SmartCart.isComponentVisible
⇒ boolean
SmartCart.isComponentVisible
⇒ boolean
Determines whether a Smart Cart component is visible based on its visibility status
Returns: boolean
- Whether the component is visible
Param | Type | Description |
---|---|---|
component | object | A Smart Cart component object from the settings.components array |
SmartCart.setCart
SmartCart.setCart
Sets the internal SmartCart.cart object, syncs the cart note (if applicable), and enriches the cart product data
Param | Type | Description |
---|---|---|
cart | object | The Shopify cart object to set as the Smart Cart cart |
SmartCart.shouldUseProductMetafields
⇒ boolean
SmartCart.shouldUseProductMetafields
⇒ boolean
Gets the setting value for Enable Product Metafields in the Smart Cart
(used to determine whether to include product metafields in the Smart Cart enriched data)
Returns: boolean
- Whether the setting is enabled
SmartCart.show
SmartCart.show
Shows the Smart Cart to the customer, initializes any announcement bars, and triggers the Smart Cart show event
Param | Type | Description |
---|---|---|
e | event | The event object (if applicable) |
SmartCart.sizeImage
⇒ string
SmartCart.sizeImage
⇒ string
Gets a Shopify image size URL with a specified size
Returns: string
- The new image URL with the specified size
Param | Type | Description |
---|---|---|
src | string | The original image URL |
size | string | The desired image size (ie. 'small', 'medium', 'large') |
SmartCart.updateCartCount
SmartCart.updateCartCount
Updates the Cart Item Count element with the current item count
(if the Item Count selector is defined in the Theme Selectors in settings)
SmartCart.updateCartSubtotal
SmartCart.updateCartSubtotal
Updates the Cart Subtotal element with the current subtotal
(if the Cart Subtotal selector is defined in the Theme Selectors in settings)
SmartCart.updateLiveRegion
SmartCart.updateLiveRegion
Updates the ARIA Live Region in the Smart Cart with a message
Param | Type | Description |
---|---|---|
message | string | The message to display in the live region |