I'm using Drupal 9 with Commerce 2. I have a large number of product types that need to be created. I have for each product type which fields need to be added. Let's say this information is stored in a json (I can vary this if the solution requires it). I was wondering if there is a way to create a module or something that iterates through this json file, and it creates all the product types. If there is, how would I go about implementing this?
I found some code examples with which I can create products programmatically here. I'm just not entirely sure how I would use this code inside a custom module.
I appreciate the help in advance!