#
Commercetools sunrise products
You can run the following command to populate your Commercetools instance with products either generated at random or by using the OpenAI API1:
rocket commercetools sunrise products
Note
If you don't have any categories in your Commercetools instance, sunrise
will ask you to create some using the sunrise categories
command.
#
Preliminary questions
Before the sunrise
command begins generating products, it will ask you:
- if you would like to provide an OpenAI API key (if you don't have an API key, it will use the
faker
library) - how many products you wish to create
- which product types your newly created products should belong to
- how many variants each product should have
#
Product features
The generated products will use the following Commercetools features as best as they can be randomly generated:
- product type (chosen randomly from your previous selection)
- category (chosen at random)
- description
- master variant and n variants, each with:
- price
- SKU
- images, generated by seeding a random Flickr API2 with the product's category
- inventory
- attributes (see below)
#
Attributes
Currently, the following attribute types can be randomly generated by the sunrise
command:
The attribute type reference
will currently be filled if the referenced object is a product
, category
, or product-type
. Otherwise, the attribute will be left empty.
Note
If you have a text
attribute called json
, it will get filled with a stringify
ed JSON object with random attribute keys and values. This was implemented to accomodate the catch-all product type.
#
Scopes
You need the following Commercetools OAuth 2.0 scopes to run this command:
manage_products:{projectKey}
-
Rocket might ask you to provide the credentials to connect to Commercetools.↩
-
LoremFlickr will only return images with a Creative Commons license. The specific license is indicated in the top left corner of the image.↩