Skip to main content

Preload Inline Cart to increase loading speed

Preload Inline Cart to increase loading speed

Last updated: 24-Nov-2025
Rate this article:

Overview

To decrease the checkout loading time you can preload the Inline Checkout in the background on page load or when the customer selects the product.

Use case

  1. Add an HTML link or button in your page like the one below.
  2. Create a JavaScript click handler to execute the Inline Client desired methods.
  3. Use the TwoCoInlineCart.products.add({code, quantity, options}) method to prepare your products.
  4. Use the TwoCoInlineCart.cart.preload() method to load the cart in the background.
  5. Use the TwoCoInlineCart.cart.reloadCart() method to show the cart on your page.

Sample request

HTML

<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>

Javascript


window.addEventListener("load", (event) => {
  TwoCoInlineCart.products.add({
    code: "2CO3MONTHS",
    qty: 1
  });
  TwoCoInlineCart.cart.preload();
});

window.document.getElementById('buy-button').addEventListener('click', function() {
  TwoCoInlineCart.cart.reloadCart();
});

Demo (Using Test Mode)

Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo