You are here

drupal-8

Importing a price in Drupal 8 for Drupal Commerce 2.x

Just a quick note that if you're importing a Commerce price:

  • you must set the currency_code.
  • what was commerce_price in DC 1.x / Drupal 7 is now just price.
  • the number can be a decimal now.

    'price/number': SomeFieldName 'price/currency_code': plugin: default_value default_value: 'USD'

Note that you can also set up a constant in the migration definition and use the constant value:

You can chain callbacks in a Drupal 8 migration

If you're wanting to do some advanced processing (e.g. lowercasing a word and then capitalizing the first letter) you can chain the two callbacks to get the desired effect:

Quickly importing new config entities from the command line using Drush

Drush's cset command is a bit picky, but with a few command line options, we can get it to import a yaml file into our site's config:

drush -y --format=yaml cset config.entity.string '' - < config_file.yml

This will put the entirety of config_file.yml into the configuration entity config.entity.string.