Finding a product id using code

Hello! My name is David and I’ve been working on a website that creates custom products.

I’ve been able to create a product using the createProduct() method, but can’t seem to call the product ID to add it to cart.

The errors I got is in the screenshot below.

I’ve been trying to set the id within the createProduct() declaration, but it doesn’t seem to link when I try to add it.

Is there a way to set a product’s ID within createProduct()?

If not, is there a way to get the product ID using the name of the product?

Any help would be greatly appreciated!

CreateProduct will generate the unique ID in the return. Here are the API docs that will explain all the parameters you are able to set

Thank you so much! Using the returned ID, I was able to generate the custom product.