All Collections
Express Checkout
Turn off lazy loading for the Express Checkout
Turn off lazy loading for the Express Checkout

By default, the Express Checkout is set to lazy load to improve initial page load speed. With a snippet, you can set it to load right away.

Vikrant Sant avatar
Written by Vikrant Sant
Updated over a week ago

When to use this

By default, the PeachPay Express Checkout will lazy load, which improves the initial load time of the page. This is good for SEO and is what you most likely want for your store.

However, if you feel it takes a while for the Express Checkout window to appear after clicking the button, there's a tradeoff you can make to have it load faster, at the cost of a slightly slower initial page load.

Usage example

This can be added to a child theme's functions.php or using any snippet plugin like Code Snippets.

/**
* Make the PeachPay Express Checkout iframe load immediately on page load
* instead of when the Express Checkout button is clicked.
**/
function pp_checkout_snippet_load_mode( $data ) {
$data["load_mode"] = "eager";
return $data;
}

add_filter( "pp_checkout_button_data", "pp_checkout_snippet_load_mode" );
Did this answer your question?