Checkout Area Methods
SmartCart.adjustPreviewButtons ⇒ void¶
Updates the Accelerated Checkout buttons for previewing in the Admin.
| Param | Type | Description |
|---|---|---|
| settings | object |
Smart Cart settings |
SmartCart.appendAcceleratedCheckout ⇒ void¶
Appends the '.additional-checkout-buttons' element to the SmartCart flyout
SmartCart.checkout ⇒ void¶
Performs the checkout process
Example
// Trigger checkout programmatically
document.querySelector('.custom-checkout-btn').addEventListener('click', () => {
SmartCart.checkout();
});
SmartCart.checkoutLabel ⇒ string¶
Gets the label for the checkout button
Returns: string - The label for the checkout button (HTML content) ## SmartCart.clearAcceleratedCheckout ⇒ void
Removes the '.additional-checkout-buttons' element from the SmartCart flyout
SmartCart.continueShoppingLabel ⇒ string¶
Get the label for the Continue Shopping button
Returns: string - The label for the Continue Shopping button ## SmartCart.getAdditionalCheckoutButtons ⇒ boolean | object
Checks for the existence of the '.additional-checkout-buttons' element, which is used by the 'rebuy-smartcart-extensions.liquid' snippet
Returns: boolean | object - returns false otherwise buttonContainers, buttonContainer, buttonList, buttonListItems.
| Param | Type | Description |
|---|---|---|
| parent | Element |
DOM Element |
SmartCart.getCheckoutSettings ⇒ object¶
gets the checkout settings from the SmartCart
Returns: object - The checkout settings object ## SmartCart.hasAcceptedTerms ⇒ boolean
Checks if the user has accepted the terms and conditions
Returns: boolean - True if the user has accepted the terms, otherwise false ## SmartCart.hasCheckoutButton ⇒ boolean
Checks if the checkout button is enabled
Returns: boolean - True if the checkout button is enabled, otherwise false
Example
// Conditionally show custom checkout UI
if (SmartCart.hasCheckoutButton()) {
document.querySelector('.checkout-section').style.display = 'block';
}
SmartCart.hasContinueShoppingButton ⇒ boolean¶
Checks if the Continue Shopping button is enabled
Returns: boolean - True if the Continue Shopping button is enabled, otherwise false ## SmartCart.hasPrePurchase ⇒ boolean
Returns true if there is a pre-purchase pop-up widget enabled
SmartCart.hasShopPayButton ⇒ boolean¶
Checks if the Shop Pay button is enabled
Returns: boolean - True if the Shop Pay button is enabled, otherwise false ## SmartCart.hasTermsEnabled ⇒ boolean
Determines if the terms and conditions are enabled in settings
Returns: boolean - True if terms and conditions are enabled, otherwise false
Example
// Check if terms must be accepted before checkout
if (SmartCart.hasTermsEnabled()) {
if (!SmartCart.hasAcceptedTerms()) {
console.log('Please accept terms before checkout');
}
}
SmartCart.hasViewCartButton ⇒ boolean¶
Checks if the View Cart button is enabled
Returns: boolean - True if the View Cart button is enabled, otherwise false ## SmartCart.installmentsEnabled ⇒ boolean
Returns true if the payment installments indicator text is enabled
SmartCart.installmentsMessage ⇒ string¶
Returns the payment installments indicator text
Returns: string - HTML ## SmartCart.manageAcceleratedCheckout ⇒ void
Manages the Accelerated Checkout feature
SmartCart.prePurchaseWidgetId ⇒ string¶
Returns the pre-purchase pop-up widget ID
SmartCart.renderPayPalButton¶
Conditionally renders a paypal button if the PayPal iFrame is not rendered
SmartCart.shopPayCheckout ⇒ void¶
Performs the Shop Pay checkout process
SmartCart.shopPaySvg : string¶
SVG code for the Shop Pay icon.
SmartCart.updateTermsCheck ⇒ void¶
Update the terms checkbox status
SmartCart.viewCart¶
Navigates to the Shopify Cart Page
Example
// Navigate to the cart page with a custom button
document.querySelector('.view-cart-btn').addEventListener('click', () => {
SmartCart.viewCart();
});
SmartCart.viewCartLabel ⇒ string¶
Gets the label for the View Cart button
Returns: string - The label for the View Cart button