createCheckoutFromTemplate( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Creates a new checkout based on the checkout template.

Before using this function, you must have a checkout template available. Create a checkout template with createCheckoutTemplate().

The customer can be directed to the new checkout using the checkout's checkoutUrl.

Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function createCheckoutFromTemplate(
  checkoutTemplateId: string,
  siteId: string,
): Promise<CreateCheckoutFromTemplateResponse>;
Method Parameters
checkoutTemplateIdstringRequired

ID of the checkout template to use to create a checkout from.


siteIdstringRequired

ID of the site associated with the checkout template.

Returns
Return Type:Promise<CreateCheckoutFromTemplateResponse>
JavaScript
import { checkoutTemplates } from "wix-ecom-backend"; async function createCheckoutFromTemplate(checkoutTemplateId, siteId) { try { const result = await checkoutTemplates.createCheckoutFromTemplate( checkoutTemplateId, siteId, ); return result; } 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?