Skip to content

saleor/configurator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Configurator

Warning

This project is in early development. Please use with caution.

Configurator is a tool that helps you automate the creation of data models in Saleor. Instead of, for example, manually creating product types and attributes, you can define them in a configuration file and let the tool do the rest.

Example

// Example config.yml
shop:
  customerAllowedToSetExternalReference: false
  defaultMailSenderName: "Saleor Store"
  defaultMailSenderAddress: "[email protected]"
  displayGrossPrices: true
  enableAccountConfirmationByEmail: true
  limitQuantityPerCheckout: 50
  trackInventoryByDefault: true
  reserveStockDurationAnonymousUser: 60
  reserveStockDurationAuthenticatedUser: 120
  defaultDigitalMaxDownloads: 5
  defaultDigitalUrlValidDays: 30
  defaultWeightUnit: KG
  allowLoginWithoutConfirmation: false
  companyAddress:
    streetAddress1: "123 Main St"
    streetAddress2: "Suite 101"
    city: "San Francisco"
    cityArea: "Downtown"
    postalCode: "94105"
    country: "US"
    countryArea: "CA"
    companyName: "Saleor Commerce"
    phone: "+1 234 567 8901"

channels:
  - name: Poland
    currencyCode: PLN
    defaultCountry: PL
    slug: poland
    settings:
      allocationStrategy: PRIORITIZE_SORTING_ORDER
      automaticallyConfirmAllNewOrders: true
      automaticallyFulfillNonShippableGiftCard: true
      expireOrdersAfter: 30
      deleteExpiredOrdersAfter: 60
      markAsPaidStrategy: TRANSACTION_FLOW
      allowUnpaidOrders: false
      includeDraftOrderInVoucherUsage: true
      useLegacyErrorFlow: false
      automaticallyCompleteFullyPaidCheckouts: true
      defaultTransactionFlowStrategy: AUTHORIZATION

productTypes:
  - name: Book
    attributes:
      - name: Author
        inputType: PLAIN_TEXT
      - name: Genre
        inputType: DROPDOWN
        values:
          - name: Fiction
          - name: Non-Fiction
          - name: Fantasy

pageTypes:
  - name: Blog Post
    attributes:
      - name: Title
        inputType: PLAIN_TEXT
      - name: Description
        inputType: PLAIN_TEXT
      - name: Published Date
        inputType: DATE

Development

Installing dependencies

pnpm install

This will install the dependencies and fetch the Saleor schema needed for gql.tada to generate the types.

Environment variables

cp .env.example .env

This will create a .env file. Here are the variables you need to set:

  • APP_TOKEN: An app token with the necessary permissions to create the data models. You can create one by going to ConfigurationWebhooks & Events in the Saleor dashboard.
  • SALEOR_API_URL: The URL of the Saleor instance you want to use.

Commands

pnpm bootstrap

Reads the configuration file and create the data models in Saleor.

Currently, it supports:

  • Creating attributes
  • Creating product types with attributes
  • Creating page types with attributes
  • Creating channels
  • Reading the configuration from config.yml file
  • Creating and updating channels with settings (payment, stock, order, checkout)
  • Updating shop settings
  • Creating channels with warehouses
  • Creating channels with warehouses and shipping zones
  • Creating products
  • Creating products with variants
  • Creating discounts
  • Creating collections
  • Creating collections with products
  • Creating categories
  • Creating categories with products

pnpm retrieve

Retrieves the configuration from the Saleor instance and saves it to a file.

Currently, it supports:

  • Fetching channels
  • Saving config to config.yml file
  • Fetching product types
  • Fetching page types
  • Fetching attributes

Limitations

  • Configurator fetches first 100 items from all paginated queries.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published