Preload Inline Cart to increase loading speed
Last updated: 24-Nov-2025
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.
TwoCoInlineCart.products.add({code, quantity, options}) method to prepare your products.TwoCoInlineCart.cart.preload() method to load the cart in the background.TwoCoInlineCart.cart.reloadCart() method to show the cart on your page.<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>
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();
});
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.
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.