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: Legacy JavaScript methods for Smart Cart integration 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 SmartCart.announcementBarEnabled(); ``` ## checkout When this method is called the customer will be re-directed to the checkout page. ```javascript SmartCart.checkout(); ``` ## checkoutLabel Returns a string which is the label specified in the Smart Cart admin settings for the checkout button. ```javascript 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 SmartCart.compareAtPrice(item); ``` ## continueShoppingLabel Returns a string which is the label specified in the Smart Cart admin settings for the continue shopping button. ```javascript SmartCart.continueShoppingLabel(); ``` ## currency Returns a string which is the currency of the store. (example: 'USD') ```javascript SmartCart.currency(); ``` ## decreaseItem Will decrease the item quantity count of the item that is passed into this method as the first parameter. ```javascript 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 SmartCart.destroy(); ``` ## discountTotal Returns a string which is a formatted dollar amount of the total discount of the items in the cart. ```javascript SmartCart.discountTotal(format); ``` ## emptyCartMessage Returns a string which is the message specified from the Smart Cart admin settings. ```javascript SmartCart.emptyCartMessage(); ``` ## formatMoney Provides the same functionality of Rebuy.Cart.formatMoney(); ```javascript SmartCart.formatMoney(price, format); ``` ## freeShippingCompleteMessage Returns a string which is the free shipping complete message specified from the Smart Cart admin settings. ```javascript SmartCart.freeShippingCompleteMessage(); ``` ## freeShippingEnabled Returns a boolean (true) if the free shipping bar is enabled. ```javascript SmartCart.freeShippingEnabled(); ``` ## freeShippingHelperMessage ```javascript SmartCart.freeShippingHelperMessage(); ``` ## freeShippingMinimum Returns a number which is the total required to achieve free shipping. ```javascript SmartCart.freeShippingMinimum(); ``` ## freeShippingOnAllProductsEnabled Returns a boolean (true) if free shipping on all products setting is enabled from the Smart Cart admin settings. ```javascript SmartCart.freeShippingOnAllProductsEnabled(); ``` ## freeShippingPercentComplete Returns a string which is a percentage of the remaining amount to achieve free shipping. (example '50%') ```javascript SmartCart.freeShippingPercentComplete(); ``` ## freeShippingRemaining Returns a number which is the remaining amount dollar amount to achieve free shipping. ```javascript SmartCart.freeShippingRemaining(); ``` ## freeShippingRemainingMessage ```javascript 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 SmartCart.hasCheckoutButton(); ``` ## hasContinueShoppingButton Returns a boolean (true) if the continue shopping button is enabled from the Smart Cart admin settings. ```javascript SmartCart.hasContinueShoppingButton(); ``` ## hasCrossSells Returns a boolean (true) if there is one or more cross sell widgets enabled from the Smart Cart admin settings. ```javascript SmartCart.hasCrossSells(); ``` ## hasFreeShipping Returns a boolean (true) if the free shipping bar is enabled from the Smart Cart admin settings. ```javascript SmartCart.hasFreeShipping(); ``` ## hasFreeShippingProgress Returns a boolean (true) if the customer has not reached the specified price for free shipping. ```javascript SmartCart.hasFreeShippingProgress(); ``` ## hasItems Returns a boolean (true) if the cart has items. ```javascript SmartCart.hasItems(); ``` ## hasLineItemDiscount Returns a boolean (true) if the item object passed in as an argument contains a line item discount. ```javascript SmartCart.hasLineItemDiscount(item); ``` ## hasPrePurchase ```javascript SmartCart.hasPrePurchase(); ``` ## hasSwitchToSubscription Returns a boolean (true) when the item passed in as an argument has the switch to subscription functionality. ```javascript SmartCart.hasSwitchToSubscription(item); ``` ## hasTermsEnabled Returns a boolean (true) if the terms and conditions setting is enabled from the Smart Cart admin settings. ```javascript SmartCart.hasTermsEnabled(); ``` ## hasViewCartButton Returns a boolean (true) if the view cart button is enabled from the Smart Cart admin settings. ```javascript SmartCart.hasViewCartButton(); ``` ## hiddenItems Returns an array of objects which are items that have the product tag of 'smart-cart-hidden'. ```javascript SmartCart.hiddenItems(); ``` ## hide Will close the Smart Cart when this method is called. ```javascript 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 SmartCart.hideQuantitySelectors(item); ``` ## increaseItem This method will increase the quantity of the item object passed in as an argument by one. ```javascript SmartCart.increaseItem(item, callback); ``` ## init This method initializes the Smart Cart. ```javascript SmartCart.init(settings); ``` ## installmentsEnabled Returns a boolean (true) when the merchant has the payment installments enabled from the Smart Cart admin settings. ```javascript 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 SmartCart.installmentsMessage(); ``` ## isHiddenItem Returns a boolean (true) when the item object passed in contains the product tag of 'smart-cart-hidden'. ```javascript SmartCart.isHiddenItem(item); ``` ## itemCount Returns a number which is the total items in the cart including items that have more than one quantity. ```javascript SmartCart.itemCount(); ``` ## itemDeliveryFrequency ```javascript SmartCart.itemDeliveryFrequency(item); ``` ## itemDeliveryIntervalFrequency ```javascript 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 SmartCart.itemHasDiscount(item); ``` ## itemPrice Returns a number which is the unformatted final price of the item object passed in as an argument. ```javascript 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 SmartCart.items(); ``` ## itemURL Returns a string which it the relative URL of the item object passed in as an argument. ```javascript SmartCart.itemURL(item); ``` ## lineCount ```javascript 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 SmartCart.lineItemDiscountMessage(item); ``` ## notesChange ```javascript SmartCart.notesChange(event); ``` ## notesEnabled Returns a boolean (true) if the notes setting from the Smart Cart admin settings is enabled. ```javascript SmartCart.notesEnabled(); ``` ## notesIsVisible Returns a boolean (true) if the notes text area is visible. ```javascript SmartCart.notesIsVisible(); ``` ## notesRemainingCharacters ```javascript SmartCart.notesRemainingCharacters(); ``` ## notesToggle This method toggles the notes text area open and closed along with setting the input checkbox respective to the setting. ```javascript SmartCart.notesToggle(); ``` ## onetimeOptionGroupLabel ```javascript SmartCart.onetimeOptionGroupLabel(item); ``` ## onetimeOptionLabel ```javascript 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 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 SmartCart.shippingExcludedSubtotal(); ``` ## show Will open the Smart Cart when this method is called. ```javascript 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 SmartCart.skip_open = true; ```