Methods - Legacy
All methods below are as if the Smart Cart object has a reference variable defined as shown in this code snippet.
This is not a complete list of the globally available function but the ones that we find most helpful.
announcementBarEnabled¶
Returns a boolean (true) if the announcement bar is enabled.
checkout¶
When this method is called the customer will be re-directed to the checkout page.
checkoutLabel¶
Returns a string which is the label specified in the Smart Cart admin settings for the checkout button.
compareAtPrice¶
Returns the compare at price of the item passed in as an argument. Will return null if the item does not have a compare at price.
continueShoppingLabel¶
Returns a string which is the label specified in the Smart Cart admin settings for the continue shopping button.
currency¶
Returns a string which is the currency of the store. (example: 'USD')
decreaseItem¶
Will decrease the item quantity count of the item that is passed into this method as the first parameter.
destroy¶
When this function is called it will remove the Smart Cart from the DOM and delete all events relating to the Smart Cart.
discountTotal¶
Returns a string which is a formatted dollar amount of the total discount of the items in the cart.
emptyCartMessage¶
Returns a string which is the message specified from the Smart Cart admin settings.
formatMoney¶
Provides the same functionality of Rebuy.Cart.formatMoney();
freeShippingCompleteMessage¶
Returns a string which is the free shipping complete message specified from the Smart Cart admin settings.
freeShippingEnabled¶
Returns a boolean (true) if the free shipping bar is enabled.
freeShippingHelperMessage¶
freeShippingMinimum¶
Returns a number which is the total required to achieve free shipping.
freeShippingOnAllProductsEnabled¶
Returns a boolean (true) if free shipping on all products setting is enabled from the Smart Cart admin settings.
freeShippingPercentComplete¶
Returns a string which is a percentage of the remaining amount to achieve free shipping. (example '50%')
freeShippingRemaining¶
Returns a number which is the remaining amount dollar amount to achieve free shipping.
freeShippingRemainingMessage¶
hasAcceptedTerms¶
Returns a boolean (true) if the customer has accepted the terms and conditions checkbox input if this setting is enabled.
hasCheckoutButton¶
Returns a boolean (true) if the checkout button is enabled from the Smart Cart admin settings.
hasContinueShoppingButton¶
Returns a boolean (true) if the continue shopping button is enabled from the Smart Cart admin settings.
hasCrossSells¶
Returns a boolean (true) if there is one or more cross sell widgets enabled from the Smart Cart admin settings.
hasFreeShipping¶
Returns a boolean (true) if the free shipping bar is enabled from the Smart Cart admin settings.
hasFreeShippingProgress¶
Returns a boolean (true) if the customer has not reached the specified price for free shipping.
hasItems¶
Returns a boolean (true) if the cart has items.
hasLineItemDiscount¶
Returns a boolean (true) if the item object passed in as an argument contains a line item discount.
hasPrePurchase¶
hasSwitchToSubscription¶
Returns a boolean (true) when the item passed in as an argument has the switch to subscription functionality.
hasTermsEnabled¶
Returns a boolean (true) if the terms and conditions setting is enabled from the Smart Cart admin settings.
hasViewCartButton¶
Returns a boolean (true) if the view cart button is enabled from the Smart Cart admin settings.
hiddenItems¶
Returns an array of objects which are items that have the product tag of 'smart-cart-hidden'.
hide¶
Will close the Smart Cart when this method is called.
hideQuantitySelectors¶
Returns a boolean (true) if the item passed into this method has a product tag of 'smart-cart-hide-qty'.
increaseItem¶
This method will increase the quantity of the item object passed in as an argument by one.
init¶
This method initializes the Smart Cart.
installmentsEnabled¶
Returns a boolean (true) when the merchant has the payment installments enabled from the Smart Cart admin settings.
installmentsMessage¶
Returns a string which contains HTML in order to provide click functionality to the specified installments provider as specified from the Smart Cart admin settings.
isHiddenItem¶
Returns a boolean (true) when the item object passed in contains the product tag of 'smart-cart-hidden'.
itemCount¶
Returns a number which is the total items in the cart including items that have more than one quantity.
itemDeliveryFrequency¶
itemDeliveryIntervalFrequency¶
itemHasDiscount¶
Returns a boolean (true) if the item object passed in as an argument has a compare at price or has a Shopify script discount.
itemPrice¶
Returns a number which is the unformatted final price of the item object passed in as an argument.
itemProductTagsClasses¶
Returns a string of the product tags of the item object passed in as an argument where each tag it preceded with 'tag-'
//'tag-available tag-best-seller tag-skinbarrierpage tag-skincare tag-spodefault tag-spodisabled'
items¶
Returns an array of objects where each object it an item in the cart.
itemURL¶
Returns a string which it the relative URL of the item object passed in as an argument.
lineCount¶
lineItemDiscountMessage¶
Returns a string which is the discount message provided from a Shopify discounting script. Length equals zero if there is no discount or no message provided for the discount.
notesChange¶
notesEnabled¶
Returns a boolean (true) if the notes setting from the Smart Cart admin settings is enabled.
notesIsVisible¶
Returns a boolean (true) if the notes text area is visible.
notesRemainingCharacters¶
notesToggle¶
This method toggles the notes text area open and closed along with setting the input checkbox respective to the setting.
onetimeOptionGroupLabel¶
onetimeOptionLabel¶
removeItem¶
This method make the API call to Shopify to remove the item object that is passed in as an argument.
shippingExcludedSubtotal¶
Returns a number which is the difference between items that do and do not have the product tag 'smart-cart-shipping-excluded'. This tag can be added to products in order to have them not count toward the remaining amount of the free shipping bar.
show¶
Will open the Smart Cart when this method is called.
skip_open¶
When setting this to true, it will prevent Smart Cart from opening when an item is added to cart (clicking on cart icon will still allow the Smart Cart to open, however).
--- title: Methods - Legacy excerpt: '' deprecated: false hidden: false metadata: title: '' description: '' robots: index next: description: '' --- All methods below are as if the Smart Cart object has a reference variable defined as shown in this code snippet. ```javascript title="Smart Cart reference" const SmartCart = window.Rebuy.SmartCart; ``` This is not a complete list of the globally available function but the ones that we find most helpful. ## announcementBarEnabled Returns a boolean (true) if the announcement bar is enabled. ```javascript title="SmartCart.announcementBarEnabled();" ``` ## checkout When this method is called the customer will be re-directed to the checkout page. ```javascript title="SmartCart.checkout();" ``` ## checkoutLabel Returns a string which is the label specified in the Smart Cart admin settings for the checkout button. ```javascript title="SmartCart.checkoutLabel();" ``` ## compareAtPrice Returns the compare at price of the item passed in as an argument. Will return null if the item does not have a compare at price. ```javascript title="SmartCart.compareAtPrice(item);" ``` ## continueShoppingLabel Returns a string which is the label specified in the Smart Cart admin settings for the continue shopping button. ```javascript title="SmartCart.continueShoppingLabel();" ``` ## currency Returns a string which is the currency of the store. (example: 'USD') ```javascript title="SmartCart.currency();" ``` ## decreaseItem Will decrease the item quantity count of the item that is passed into this method as the first parameter. ```javascript title="SmartCart.decreaseItem(item, callback);" ``` ## destroy When this function is called it will remove the Smart Cart from the DOM and delete all events relating to the Smart Cart. ```javascript title="SmartCart.destroy();" ``` ## discountTotal Returns a string which is a formatted dollar amount of the total discount of the items in the cart. ```javascript title="SmartCart.discountTotal(format);" ``` ## emptyCartMessage Returns a string which is the message specified from the Smart Cart admin settings. ```javascript title="SmartCart.emptyCartMessage();" ``` ## formatMoney Provides the same functionality of Rebuy.Cart.formatMoney(); ```javascript title="SmartCart.formatMoney(price, format);" ``` ## freeShippingCompleteMessage Returns a string which is the free shipping complete message specified from the Smart Cart admin settings. ```javascript title="SmartCart.freeShippingCompleteMessage();" ``` ## freeShippingEnabled Returns a boolean (true) if the free shipping bar is enabled. ```javascript title="SmartCart.freeShippingEnabled();" ``` ## freeShippingHelperMessage ```javascript title="SmartCart.freeShippingHelperMessage();" ``` ## freeShippingMinimum Returns a number which is the total required to achieve free shipping. ```javascript title="SmartCart.freeShippingMinimum();" ``` ## freeShippingOnAllProductsEnabled Returns a boolean (true) if free shipping on all products setting is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.freeShippingOnAllProductsEnabled();" ``` ## freeShippingPercentComplete Returns a string which is a percentage of the remaining amount to achieve free shipping. (example '50%') ```javascript title="SmartCart.freeShippingPercentComplete();" ``` ## freeShippingRemaining Returns a number which is the remaining amount dollar amount to achieve free shipping. ```javascript title="SmartCart.freeShippingRemaining();" ``` ## freeShippingRemainingMessage ```javascript title="SmartCart.freeShippingRemainingMessage();" ``` ## hasAcceptedTerms Returns a boolean (true) if the customer has accepted the terms and conditions checkbox input if this setting is enabled. ```javascript .SmartCart.hasAcceptedTerms(); ``` ## hasCheckoutButton Returns a boolean (true) if the checkout button is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasCheckoutButton();" ``` ## hasContinueShoppingButton Returns a boolean (true) if the continue shopping button is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasContinueShoppingButton();" ``` ## hasCrossSells Returns a boolean (true) if there is one or more cross sell widgets enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasCrossSells();" ``` ## hasFreeShipping Returns a boolean (true) if the free shipping bar is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasFreeShipping();" ``` ## hasFreeShippingProgress Returns a boolean (true) if the customer has not reached the specified price for free shipping. ```javascript title="SmartCart.hasFreeShippingProgress();" ``` ## hasItems Returns a boolean (true) if the cart has items. ```javascript title="SmartCart.hasItems();" ``` ## hasLineItemDiscount Returns a boolean (true) if the item object passed in as an argument contains a line item discount. ```javascript title="SmartCart.hasLineItemDiscount(item);" ``` ## hasPrePurchase ```javascript title="SmartCart.hasPrePurchase();" ``` ## hasSwitchToSubscription Returns a boolean (true) when the item passed in as an argument has the switch to subscription functionality. ```javascript title="SmartCart.hasSwitchToSubscription(item);" ``` ## hasTermsEnabled Returns a boolean (true) if the terms and conditions setting is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasTermsEnabled();" ``` ## hasViewCartButton Returns a boolean (true) if the view cart button is enabled from the Smart Cart admin settings. ```javascript title="SmartCart.hasViewCartButton();" ``` ## hiddenItems Returns an array of objects which are items that have the product tag of 'smart-cart-hidden'. ```javascript title="SmartCart.hiddenItems();" ``` ## hide Will close the Smart Cart when this method is called. ```javascript title="SmartCart.hide(event);" ``` ## hideQuantitySelectors Returns a boolean (true) if the item passed into this method has a product tag of 'smart-cart-hide-qty'. ```javascript title="SmartCart.hideQuantitySelectors(item);" ``` ## increaseItem This method will increase the quantity of the item object passed in as an argument by one. ```javascript title="SmartCart.increaseItem(item, callback);" ``` ## init This method initializes the Smart Cart. ```javascript title="SmartCart.init(settings);" ``` ## installmentsEnabled Returns a boolean (true) when the merchant has the payment installments enabled from the Smart Cart admin settings. ```javascript title="SmartCart.installmentsEnabled();" ``` ## installmentsMessage Returns a string which contains HTML in order to provide click functionality to the specified installments provider as specified from the Smart Cart admin settings. ```javascript title="SmartCart.installmentsMessage();" ``` ## isHiddenItem Returns a boolean (true) when the item object passed in contains the product tag of 'smart-cart-hidden'. ```javascript title="SmartCart.isHiddenItem(item);" ``` ## itemCount Returns a number which is the total items in the cart including items that have more than one quantity. ```javascript title="SmartCart.itemCount();" ``` ## itemDeliveryFrequency ```javascript title="SmartCart.itemDeliveryFrequency(item);" ``` ## itemDeliveryIntervalFrequency ```javascript title="SmartCart.itemDeliveryIntervalFrequency(item);" ``` ## itemHasDiscount Returns a boolean (true) if the item object passed in as an argument has a compare at price or has a Shopify script discount. ```javascript title="SmartCart.itemHasDiscount(item);" ``` ## itemPrice Returns a number which is the unformatted final price of the item object passed in as an argument. ```javascript title="SmartCart.itemPrice(item);" ``` ## itemProductTagsClasses Returns a string of the product tags of the item object passed in as an argument where each tag it preceded with 'tag-' ```javascript title="SmartCart.itemProductTagsClasses(item);" //'tag-available tag-best-seller tag-skinbarrierpage tag-skincare tag-spodefault tag-spodisabled' ``` ## items Returns an array of objects where each object it an item in the cart. ```javascript title="SmartCart.items();" ``` ## itemURL Returns a string which it the relative URL of the item object passed in as an argument. ```javascript title="SmartCart.itemURL(item);" ``` ## lineCount ```javascript title="SmartCart.lineCount();" ``` ## lineItemDiscountMessage Returns a string which is the discount message provided from a Shopify discounting script. Length equals zero if there is no discount or no message provided for the discount. ```javascript title="SmartCart.lineItemDiscountMessage(item);" ``` ## notesChange ```javascript title="SmartCart.notesChange(event);" ``` ## notesEnabled Returns a boolean (true) if the notes setting from the Smart Cart admin settings is enabled. ```javascript title="SmartCart.notesEnabled();" ``` ## notesIsVisible Returns a boolean (true) if the notes text area is visible. ```javascript title="SmartCart.notesIsVisible();" ``` ## notesRemainingCharacters ```javascript title="SmartCart.notesRemainingCharacters();" ``` ## notesToggle This method toggles the notes text area open and closed along with setting the input checkbox respective to the setting. ```javascript title="SmartCart.notesToggle();" ``` ## onetimeOptionGroupLabel ```javascript title="SmartCart.onetimeOptionGroupLabel(item);" ``` ## onetimeOptionLabel ```javascript title="SmartCart.onetimeOptionLabel(item);" ``` ## removeItem This method make the API call to Shopify to remove the item object that is passed in as an argument. ```javascript title="SmartCart.removeItem(item, callback);" ``` ## shippingExcludedSubtotal Returns a number which is the difference between items that do and do not have the product tag 'smart-cart-shipping-excluded'. This tag can be added to products in order to have them not count toward the remaining amount of the free shipping bar. ```javascript title="SmartCart.shippingExcludedSubtotal();" ``` ## show Will open the Smart Cart when this method is called. ```javascript title="SmartCart.show(event);" ``` ## skip_open When setting this to true, it will prevent Smart Cart from opening when an item is added to cart (clicking on cart icon will still allow the Smart Cart to open, however). ```javascript title="SmartCart.skip_open = true;" ```