LogoLogo
Contact API support
  • Build apps
  • Site Templates
  • REST API Reference
  • Storefronts (JS API)
  • Webhook automations
  • Discounts
  • Guides
  • Changelog
  • Ecwid storefronts overview
  • Get started
    • Storefront customization options
    • Quickstart: customize storefront with Ecwid JS API
  • Track Storefront events
    • "Page is loaded" events
    • "Customer logged in" event
    • "Cart details are changed" event
    • "New order is placed" event
    • "Instant Site section load" events
  • Get Storefront details
    • Get Ecwid store ID
    • Get storefront language and currency
    • Get visitor location
    • Get public app details
  • Manage customers on the storefront
    • Get logged in customer's details
    • Manage customer's cookie consent
    • Log out customer
  • Open page on the storefront
    • Overview of open page options
    • Open product pages with params
    • Open category pages with params
    • Open search page with params
    • Open account pages with params
  • Manage cart and checkout
    • Get cart details
    • Add product to the cart
    • Remove products from the cart
    • Fully clear the cart
    • Create pre-filled shopping carts
    • Calculate cart details
    • Send customer to the checkout
    • Set customer's email for the checkout
    • Set customer's comments for order
    • Set customer's shipping and billing addresses
    • Set custom order referer
  • Store configuration settings
    • Overview
    • Behavioral configs
    • Design configs

Lightspeed® 2025

On this page
  • Ecwid.Cart.canGotoCheckout()
  • Ecwid.Cart.gotoCheckout()

Was this helpful?

  1. Manage cart and checkout

Send customer to the checkout

Ecwid.Cart.canGotoCheckout()

This method checks whether you can send customers to the first step of the checkout called the shopping cart.

It has one callback argument containing the boolean response. If true, you can send customers to the checkout with the Ecwid.Cart.gotoCheckout() method.

Ecwid.Cart.canGotoCheckout(function(callback){
  console.log(callback);
});

// prints
// true

You can only receive false with this method if the store works through an old storefront and the Ecwid admin > Settings > Legal > Terms & Conditions toggle is enabled.

Ecwid.Cart.gotoCheckout()

This method sends a customer to the first or second checkout step.

This method works differently depending on the Ecwid admin > Settings > Legal > Terms & Conditions toggle and whether the customer has already left an email in the shopping cart:

  • No email: the customer is sent to the shopping cart page.

  • Email + toggle disabled: the customer is sent to the second checkout page (address details)

  • Email + toggle disabled + no shipping: the customer is sent to the payment page.

Code example:

Ecwid.Cart.gotoCheckout(function(){
  console.log("Checkout process started");
});

// prints
// Checkout process started
// Customer is redirected to the checkout
PreviousCalculate cart detailsNextSet customer's email for the checkout

Last updated 2 months ago

Was this helpful?