createCheckoutTemplate( )


Creates a checkout template.

A checkout template is used to create a new checkout that will include predefined information. For example, a single link with a checkoutTemplateId can be shared with customers and each time the link is clicked, a new checkout page will be created for that customer with certain checkout information already populated.

The customizable features include the option to allow or to lock coupon codes or gift cards. For example, if a store owner is using the checkout template to offer a flash sale to their social media followers, they may want to lock the option to apply an additional coupon on top of the sale being offered. If so, they can set customization.lockedCoupon to true.

A checkout can be created with a checkout template by calling createCheckoutFromTemplate(). The site may add further customizations to the new checkout and then redirect the customer using the new checkout's checkoutUrl.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage eCommerce - all permissions
Manage Stores - all permissions
Manage Restaurants - all permissions
Learn more about app permissions.
Method Declaration
Copy
function createCheckoutTemplate(
  checkoutTemplate: CheckoutTemplate,
): Promise<CheckoutTemplate>;
Method Parameters
checkoutTemplateCheckoutTemplateRequired

Checkout template to create.

Returns
Return Type:Promise<CheckoutTemplate>
JavaScript
import { checkoutTemplates } from "@wix/ecom"; async function createCheckoutTemplate(checkoutTemplate) { const response = await checkoutTemplates.createCheckoutTemplate(checkoutTemplate); }
Errors
400Invalid Argument

There is 1 error with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Did this help?