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