Adding product-infos when creating a product with backend code

Hi everybody,

I want to create a product in my store when a from is submitted. Therefore I use the event "onWixFormSubmitted() including the following code:

backend-code: products.jsw

import wixStoresBackend from 'wix-stores-backend';

export function createProduct(myProduct) {
  return wixStoresBackend.createProduct(myProduct);
}

page-code:

import { createProduct } from 'backend/products';

// event when form is submitted
export function verkaufForm_wixFormSubmitted(event) {
  
  let fullName = event.fields[0].fieldValue;

  myProduct = {
  "name": fullName,
  "description": "test a random text",
  "price": 35,
  "sku": "",
  "visible": false,
  "productType": "physical",
  "trackInventory": true,
  "inStock": true,
  "quantityInStock": 1,
  "additionalInfoSections": [
    {
      "title": "Alter",
      "description": "test"
    },
    {
      "title": "Zustand",
      "description": "test"
    }
  ],
  }

  createProduct(myProduct)
  .then((product) => {
    // product created
    const productId = product._id
    const description = product.description
  })
  .catch((error) => {
    // product not created
    console.error(error)
  });
}

The main concept of the code is working and I’m able to create the products but not all values of “myProduct” are used - I don’t have the stock of 1 product and also the additional info sections are missing.

Can somebody help me here - how can I add this data to the product when creating it?

Many thanks in advance!