Wix-Store.V2 Error when creating product

Hi I am trying to create a product using the wix-stores.V2 interface but i receive an error an i am not sure how to fix it.

import { products } from 'wix-stores.v2';

 async function createProduct(product) {
   try {
     const result = await products.createProduct(product);

     return result;
   } catch (error) {
     console.error(error);
     // Handle the error
   }
 }

export function button1_click(event) {
    const PC = {
        "name": "Intel Configurator",
        "description": "Configure your very own Intel Pc",
        "priceData": {
            "price": "59.99"
        }
        
    }
	console.log(PC)
    createProduct(PC)
}

Error Given


{...}jsonTableCopy JSON
name: "Intel Configurator"
description: "Configure your very own Intel Pc"
priceData: {...}jsonTableCopy JSON
price: "59.99"
------------------------------------------------------------------------------
Error: message: ''
details:
  applicationError:
    description: Unknown
    code: UNKNOWN
    data: {}

It’s worth noting that the createProduct() API is currently in developer preview and may not function currently, and as such shouldn’t be used in live sites. - https://www.wix.com/velo/reference/wix-stores-v2/products/createproduct

That being said, it’s awesome that you’re using it and have discovered this!

@thomasj is this a known issue?

Thanks again for trying out our Developer Preview APIs.

As @noahlovell stated, these are released with the intention of creating open communication and collaboration between the community and Wix’s product team while new APIs are being developed. As a result, they are subject to change and are not intended for use in production.

I have forwarded your feedback. While I am not aware of this specific error, in general we would love feedback related to any Developer Preview APIs via email at velo-preview-feedback@wix.com

1 Like