createProduct( )


Creates a new product.

The createProduct() function receives a ProductInfo object and returns a Promise that resolves to a Product object when the product has been created.

Creating a product is the first step in the process of enabling visitors to buy your products. After you create a product, you can add choices and variants to the product.

Notes:

  • If you create a product immediately before adding it to the cart, we suggest setting a timeout for "1000" milliseconds (1 second) before calling wix-stores.cart.addProducts(). While this slows down the operation slightly, it also ensures proper retrieval of the newly created product before adding it to the cart.
  • Do not pass important information from client-side code. Doing so opens a vulnerability that a malicious user can exploit to change information, such as a buyer’s personal details (address, email, etc.) or product price information. To learn more about how to keep your code secure, see Security Considerations When Working with Wix Code.
Method Declaration
Copy
Method Parameters
productInfoProductInfoRequired

Information for the product being created.

Returns
Return Type:Promise<Product>
Was this helpful?
Yes
No