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:
function navigateToCheckoutPage(
checkoutId: string,
options: CheckoutPageOptions,
): Promise<void>;
ID of the checkout to navigate to.
Additional parameters for customizing the checkout flow.
import wixEcomFrontend from "wix-ecom-frontend";
$w("#myNavigateToCheckoutPageButton").onClick(() => {
// 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}",
};
wixEcomFrontend
.navigateToCheckoutPage(checkoutId, options)
.then(() => {
console.log("Navigated successfully");
})
.catch((error) => {
console.error(error);
// Handle the error
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.