Skip to content

Checkout Area Methods

SmartCart.adjustPreviewButtonsvoid

Updates the Accelerated Checkout buttons for previewing in the Admin.

Param Type Description
settings object Smart Cart settings

SmartCart.appendAcceleratedCheckoutvoid

Appends the '.additional-checkout-buttons' element to the SmartCart flyout

SmartCart.checkoutvoid

Performs the checkout process

Example

// Trigger checkout programmatically
document.querySelector('.custom-checkout-btn').addEventListener('click', () => {
  SmartCart.checkout();
});

SmartCart.checkoutLabelstring

Gets the label for the checkout button

Returns: string - The label for the checkout button (HTML content) ## SmartCart.clearAcceleratedCheckoutvoid

Removes the '.additional-checkout-buttons' element from the SmartCart flyout

SmartCart.continueShoppingLabelstring

Get the label for the Continue Shopping button

Returns: string - The label for the Continue Shopping button ## SmartCart.getAdditionalCheckoutButtonsboolean | 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.getCheckoutSettingsobject

gets the checkout settings from the SmartCart

Returns: object - The checkout settings object ## SmartCart.hasAcceptedTermsboolean

Checks if the user has accepted the terms and conditions

Returns: boolean - True if the user has accepted the terms, otherwise false ## SmartCart.hasCheckoutButtonboolean

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.hasContinueShoppingButtonboolean

Checks if the Continue Shopping button is enabled

Returns: boolean - True if the Continue Shopping button is enabled, otherwise false ## SmartCart.hasPrePurchaseboolean

Returns true if there is a pre-purchase pop-up widget enabled

SmartCart.hasShopPayButtonboolean

Checks if the Shop Pay button is enabled

Returns: boolean - True if the Shop Pay button is enabled, otherwise false ## SmartCart.hasTermsEnabledboolean

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.hasViewCartButtonboolean

Checks if the View Cart button is enabled

Returns: boolean - True if the View Cart button is enabled, otherwise false ## SmartCart.installmentsEnabledboolean

Returns true if the payment installments indicator text is enabled

SmartCart.installmentsMessagestring

Returns the payment installments indicator text

Returns: string - HTML ## SmartCart.manageAcceleratedCheckoutvoid

Manages the Accelerated Checkout feature

SmartCart.prePurchaseWidgetIdstring

Returns the pre-purchase pop-up widget ID

SmartCart.renderPayPalButton

Conditionally renders a paypal button if the PayPal iFrame is not rendered

SmartCart.shopPayCheckoutvoid

Performs the Shop Pay checkout process

SmartCart.shopPaySvg : string

SVG code for the Shop Pay icon.

SmartCart.updateTermsCheckvoid

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.viewCartLabelstring

Gets the label for the View Cart button

Returns: string - The label for the View Cart button

See something that needs updating? Suggest an edit