navigateToCheckoutPage( )


Directs the browser to navigate to the site visitor's Checkout Page.

The navigateToCheckoutPage() function returns a Promise that resolves when the browser successfully navigates to the Checkout Page.

Note: The checkoutId parameter is required. To get a checkoutId, use one of the following wix-ecom-backend functions:

Method Declaration
Copy
function navigateToCheckoutPage(
  checkoutId: string,
  options: CheckoutPageOptions,
): Promise<void>;
Method Parameters
checkoutIdstringRequired

ID of the checkout to navigate to.


optionsCheckoutPageOptions

Additional parameters for customizing the checkout flow.

Navigate to the checkout page
JavaScript
import { createClient } from "@wix/sdk"; import { site } from "@wix/site"; import { ecom } from "@wix/site-ecom"; const wixClient = createClient({ host: site.host(), modules: { ecom } }); document .getElementById("myNavigateToCheckoutPageButton") .addEventListener("click", async () => { // Example checkoutId and options values const checkoutId = "12345678-1234-1234-1234-1234567890ab"; const options = { skipDeliveryStep: true, hideContinueBrowsingButton: false, overrideContinueBrowsingUrl: "https://www.myExampleSite.com/upsellPage", // override ThankYouPage URL with dynamic orderId parameter overrideThankYouPageUrl: "https://www.myExampleSite.com/customThankYouPage/{orderId}", }; try { await wixClient.ecom.navigateToCheckoutPage(checkoutId, options); console.log("Navigated successfully"); } catch (error) { console.error(error); // Handle the error } });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?